Skip to content

Instantly share code, notes, and snippets.

@henrik
Created February 24, 2010 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henrik/518a6db9f3671fba6f72 to your computer and use it in GitHub Desktop.
Save henrik/518a6db9f3671fba6f72 to your computer and use it in GitHub Desktop.
Git-tips från SHRUG-presentation 2010-02-24:
- git reset --soft HEAD^
För undo, som stash.
http://henrik.nyh.se/2009/02/git-reset-soft-as-stash-replacement-and-undo
- git reflog
Om man råkat ta bort en branch. Om man rebaseat en branch eller kört reset --hard.
git reflog --all, git log --walk-reflogs
- git checkout -
Som "cd -". Bra att ha i ett alias. T.ex. växla mellan master och feature.
Sedan 1.6.2. Tidigare: git checkout @{-1}
- git checkout --ours/--theirs foo.txt
För att vid en merge välja att behålla foo.txt från denna branch (--ours) eller den inmergeade (--theirs).
Sedan 1.6.1. Tidigare: git checkout MERGE_HEAD -- foo.txt
Sedan 1.6.1. Tidigare: git checkout ORIG_HEAD -- foo.txt
- git bisect
git bisect start HEAD master
git bisect run ruby test.rb
- branch och dirty i shell prompt: http://henrik.nyh.se/2008/12/git-dirty-prompt
- auto-reference tickets from branch name: http://henrik.nyh.se/2009/09/git-hook-to-auto-reference-tickets-from-the-branchname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment