How can I find out when some portion of a file was deleted in git?

I just found out, that one of my test files is missing about 20 lines on the top. I’ve been recently trying to master VIM, so I guess I somehow managed to delete those lines without me even noticing, and then commiting it into the repository. Now the question is, what’s the best way to […]

How to go back to last commit + delete all newly created files?

As in the title: “How to go back to last commit + delete all newly created file?” Thanks.

Git: Deleted current branch and lost reflog

I ran into an unusual git issue earlier that I’ve since resolved, but I’m still curious as to why it happened. The problem occurred when I accidentally deleted the branch I was currently working on. Normally git wouldn’t allow this, but due to case-insensitivity on OSX I got myself into a situation where I thought […]

How to remove all added files in GIT

By mistake I used git add . so all files are added in staring area. I want to remove all those files from staring area. I tried git clean -fdx git clean -df but it isn’t worked.

Git/SCM Workflow: Handling changes when QA finds problems

I’m trying to make the case for switching our organization to Git from SVN. Right now our workflow essentially looks like this: Developer makes changes, then commits to Beta branch QA finds bugs, then tells the dev to fix them GOTO 1. Repeat at least 5 times. (We have no test suite. Another issue…) Peer […]

Git – Difference between amend and squash commands

Am wondering what exactly is the difference between amend and squash commands, as I tried both and found that both are doing the same for proper management.

Git-hooks pre-push script does not receive input via STDIN

The git-hooks pre-push documentation states that the first line of stdin will be populated with the local ref and sha, and the remote ref and sha as such: <local ref> SP <local sha1> SP <remote ref> SP <remote sha1> LF However, my simple pre-push script: #!/bin/bash echo “params=[$@]” read line echo “stdin=[$line]” exit 1 returns […]

Master failed to write error while pushing commit

I have a git repository on a company network drive and had no problem pulling from it. However, i wasn’t able to push any commits into it, though I had a few good luck but recently I couldn’t get anything in it. The error was: C:\Program Files\Git\bin\git.exe push “origin” master:master error: Couldn’t set refs/heads/master To […]

Why don't Git refs have a file extension

I had recently stumbled upon a common problem in Git when creating branch groups: I had a branch called “tim“. I wanted to make a folder/group called “tim“, with the “tim” branch inside it, resulting in the branch path being “tim/tim“. When I tried to do this, Git really hated me because the folder “tim” […]

Merge two git repository histories

I want to combine a cvs and a svn repository into a new git repo, without loosing history of course. The catch is the svn repo is a direct continuation of the cvs repo historywise. Someone just created the svn repo and clumsily added the last state from cvs without keeping any history. The most […]

Git Baby is a git and github fan, let's start git clone.