Sometimes you run commands that are a little complicated or just too long to write. Git has support for command aliases that are very easy to set up.
Read the rest of this entry »

Do you ever find it difficult figuring out complex merges? “Wait, was my change the part after the <<<<<<< or before the >>>>>>> ?”, “What did I do here and what did they do?”, “Oh my gawd, was this whole file modified?!?” If you find yourself asking these questions, maybe you need to use git mergetool.
Read the rest of this entry »

Wouldn’t it be great if you could find all the changes to a line in your entire history? Sort of like git blame, but only for revisions that match some string. This is where git’s pickaxe functionality comes in.
Read the rest of this entry »

Wouldn’t it be great if git had a revision number that always went up so that you could look at two of them and figure out which one was later than the other? svn, cvs, hg all have numeric commits that you can refer to, so why can’t git? It turns out that git does, it’s called git describe.
Read the rest of this entry »

While I really enjoy qgit for visualizing history, it is a graphical client. Sometimes you’re on a remote machine or want to look at a very complicated set of commits. In those cases, git show-branch might not be enough. Enter tig.
Read the rest of this entry »

Sometimes you just want a few patches from a topic branch, not the entire thing. If a bug fix was implemented that would help everyone working out of the master branch, but the rest of the topic branch isn’t acceptable, git cherry-pick is the way to go.
Read the rest of this entry »

What if you wanted to see all the revisions since a branch was created? Or all the changes included in two or more branches? Or all the changes in one branch, that has merges from another branch, but not the merges or the other branch? All of this and more can be done with git rev-parse, which is used by just about every git command that accepts a revision list.
Read the rest of this entry »

“What? I already fixed this bug! Why is it still happening?” If you don’t have a good test suite or you don’t run it regularly, finding these sorts of regressions can be difficult. Because git makes it really easy to jump to other commits (branches or history), it is very easy to narrow down what commit(s) caused the regression. git bisect helps you do that.
Read the rest of this entry »

Imagine you’re an integrator (someone who takes a lot of changes from other people and merges them) and you often merge other people’s branches, resolve conflicts, and then find bugs in the branch. Wouldn’t it be great if git could remember your conflict resolutions and replay them next time you try to merge? That’s what git rerere is for!
Read the rest of this entry »

What do you do when you have two commits in the past that you want to re-arrange? or combine? or completely obliterate? What about after you’ve created patches, emailed them to a maintainer, and that maintainer has accepted some of them into the official repo? What if you realize that your topic branch actually has two topics in it? These are all jobs for git rebase.
Read the rest of this entry »

Follow

Get every new post delivered to your Inbox.