summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-03-01 12:19:01 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-03-01 12:19:01 +0200
commit4c13c40aefbd7eb73586a75bd421a8b76661c8d4 (patch)
treea62ce0f71c2bf8034f7be1604adcb329ed44db66
parentc2c51686fa1a4f782dd841b96dd332fd84f5be4b (diff)
Add git cheat sheet
-rw-r--r--git/git-cheatsheet.txt51
1 files changed, 51 insertions, 0 deletions
diff --git a/git/git-cheatsheet.txt b/git/git-cheatsheet.txt
new file mode 100644
index 0000000..3c73666
--- /dev/null
+++ b/git/git-cheatsheet.txt
@@ -0,0 +1,51 @@
+Tag
+
+ git tag -a x.y.z -m "Tag version x.y.z"
+
+Squash multiple commits into one
+
+ git rebase -i HEAD~<N>
+
+ http://www.gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
+
+Change commit message
+
+ git commit --amend
+
+Revert uncommited changes
+
+ git reset --hard HEAD
+
+Setup remote repository
+
+ On remote:
+
+ 1. mkdir proj.git
+ 2. chgrp scm proj.git
+ 2. cd proj.git
+ 3. git --bare init --shared=all
+ 4. chgrp -R scm ../proj.git
+ 5. edit description
+ 6. cd hooks
+ 7. mv post-update.sample post-update
+
+ On local:
+
+ 1. git remote add origin scm.codesynthesis.com:/var/scm/proj/proj.git
+ 2. git push --tags origin master
+ 3. # blow the local project and do clone
+
+Rebasing
+
+ Local (e.g., from a feature branch to master):
+
+ git rebase <src> [<dst>]
+
+ If <dst> is not specified, current branch is used. If <dst> is
+ specified, it is checked out.
+
+ Remote (e.g., merge someone else's changes):
+
+ git fetch
+ git rebase origin[/master]
+ git push --tags origin