Ricardo Signes - Git is easy

In Git, a commit is not a diff. It's the full content of all files.

You can associate a name with a commit:

  • git tag v1.0
  • head - the place where you add children. You can have multiple heads: git checkout -b main - create a 'maint' branch.

Merging

You can branch the same 2 branches in different ways; which is useful for example if you have commit and are unsure of how to resolve them.

  • git checkout master # checkout moves around merges
  • git merge new-frobs
  • git branch -d new_frobs # delete the branch

Conflicts

git merge --ours|--theirs

Sharing

got clone $remote

  • git fetch origin # gets updates from the remote
  • git merge jdoes/master git pull origin master # "pull" = "fetch" + "merge"

Instead of git push origin master, which isn't interactive and can't ask you about commits, do git pull, resolve commits, then git push

Rewriting history

It's a bad name for "meta-revision control".

git commit --amend # the bad commit's name is deleted so it becomes eligible for garbage collection

Rebasing

Take your changes and diff them against a different commit M. Useful to send someone a patch against their master M, after you've branched from a previous master P.

My tags:
 
Popular tags: