Git allows you to do a binary search across commits to hunt down the commit that introduced a bug.
Given you are currently on your branch's HEAD that is not working as expected, an example workflow could be:
git bisect start # Start bisecting
git bisect bad # Tag the revision you are currently on (HEAD) as bad. You could also pass a commit's SHA1 like below:
git bisect good abcdef12345678 # Give the SHA1 of any commit that was wor...
To remove a remote branch (if you know what you are doing!)
git push origin :the_remote_branch
When you get the error
error: unable to push to unqualified destination: the_remote_branch
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to pu…
Git commits should be very deliberate, and only contain changes that you really want to be in there. In order to reduce the chance to accidentally commit something you didn't intent, review your changes before committing.
My preferred way of doing this is
git add -N .
git add -p
Git will now show you all your changes in small chunks and ask you in an interactive mode whether you really want to add them.
I am using git at several places: at work, at university, and at home. I want an own git user/email for each of those places, but I don't want to care setting the values each time I create or clone a new repository.
Git allows for setting user/email per repository, globally and system-wide, but I need a fourth dimension: per directory. By setting git environment variables using ondir, I managed to get exactly what I need.
We often have a separate production branch that lags a bit behind the more cutting edge master branch. Sometimes you want to move some, but not all commits from master to production. This can be done with a git cherry-pick.
However, this may lead to considerable pain later, since git does not understand the commits are actually "the same". Hazards are unnecessary and hard to resolve conflicts as well as incorrect auto-merges.