jemnotesversion 2 / featuring git or see all/search

Apr 13
In git, to clone a remote branch, fetch it to a branch of the same name:
git fetch origin demo:demo
Mar 27
Here are some ways of resolving a conflicted merge in git.
git checkout --theirs filename
# or
git checkout --ours filename
# or, for an interactive interface
git mergetool
Mar 7
Attach a certain remote repository within another git repository using
git submodule add /path/to/remote local_name
then, after cloning this new repository-with-a-submodule, tack on a few more steps, like this:
git clone /path/to/repo-with-submod
cd repo-with-submod
git submodule init
git submodule update
Jan 14
This is an interesting article about how I really should switch to mercurial…
Jan 13
Why, oh why do you do
git checkout sha1 filename
and things work fine, but then if you instead dared to try
git show sha1 filename
you wouldn’t get an error, your computer would just blink at you and then move on. You have to instead insert a colon:
git show sha1:filename
and the file magically appears.
But try and put the colon back in for checkout and what do you get? A nice, friendly fatal error. I will be trying mercurial as soon as I get a chance. I hope they have some scripts to migrate two-year-old git repos to mercurial.
> git checkout sha1:filename
fatal: reference is not a tree: sha1:filename
Dec 6
git’s user interface isn’t very consistent. For example, I keep forgetting how to show an historic version of a file. Take a look at this:
git diff HEAD^ file  # shows differences between previous and current version of file.
This is good. But suppose you just want to see the old file. Look at this:
git show HEAD^ file  # WRONG: prints a blank line. No messages, no warnings.
git show HEAD^:file  # RIGHT: (note colon) shows the previous version of file.
OK. So maybe you should just always use that :? Well, nope—git diff will fail if you add in the colon.
Nov 4
Sep 11
When setting up a remote repo, you now need to set up
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
May 18
A nice page explaining how to set up .gitignore rules for rails apps.
Apr 14
This is a better summary of git than I’ve seen before. I intend to write my own guide, sometime—mostly for my own learning—and will probably use some of this material to remind me what to write about.
Mar 31
Start using a remote server to backup / distribute a local app:
# On the server, to avoid having copies of local files.
git --bare init 

# On the client.
git remote add origin ssh://hostname/path/to/repo
git push origin master
Mar 30
Undo the last git commit while leaving the tree as is. (Perhaps your commit message was wrong, or you forgot to add certain files.)
git reset --soft HEAD^
Mar 28
Set up a global ignore file for git using
git config --global core.excludesfile ~/.gitignore
Mar 16
Show the history of a particular file tracked by git, using
git log -p filename
Mar 9
To immediately view the old version of a file tracked by git, use, for example,
git show HEAD^:filename
Jan 8
Oct 19
Useful page with git configuration details.