wiki

knowledgebase of randomness
git clone git://parazyd.org/wiki.git
Log | Files | Refs

Git.wiki (1097B)


      1 = Git Knowledgebase =
      2 
      3 == overwrite pull ==
      4 
      5 	git fetch --all && git reset --hard origin/master
      6 
      7 == remove branches that have been merged with master ==
      8 
      9 	git branch --merged master | grep -v '^\*' | xargs -n 1 git branch -d
     10 	git branch --merged master | grep -v '^\*\|  master' | xargs -n 1 git branch -d # will not delete master if master is not checked out
     11 
     12 == stage parts of a file instead of it all ==
     13 
     14 	git add -p
     15 
     16 == archive the master branch ==
     17 
     18 	git archive master --format=zip --output=master.zip
     19 
     20 == clean the files from gitignore ==
     21 
     22 	git clean -X -f
     23 
     24 == marks your commit as a fixup of a previous commit ==
     25 
     26 	git commit --fixup <SHA-1>
     27 
     28 == squash fixup commits normal commits ==
     29 
     30 	git rebase -i --autosquash
     31 
     32 == git undo ==
     33 
     34 	git config --global alias.undo '!f() { git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; }; f'
     35 
     36 == blame on certain range ==
     37 
     38 	git blame -L <start>,<end>
     39 
     40 == backup untracked files ==
     41 
     42 	git ls-files --others -i --exclude-standard | xargs zip untracked.zip
     43 
     44 == delete a tag from the remote ==
     45 
     46 	git tag -d 12345
     47 	git push origin :refs/tags/12345
     48