Difference between revisions of "Git"
From Vague Hope Wiki
(→Remove directory from history) |
|||
Line 71: | Line 71: | ||
<pre> | <pre> | ||
git filter-branch --tree-filter 'rm -rf com.example.foo' HEAD | git filter-branch --tree-filter 'rm -rf com.example.foo' HEAD | ||
+ | rm -rf .git/refs/original | ||
+ | rm -rf .git/logs/ | ||
+ | git gc | ||
</pre> | </pre> | ||
Revision as of 14:08, 14 September 2011
See also: Git-svn
Contents
Commands I keep forgetting
Update workspace (works for github): (Or better still, use rebase pattern described below.)
git fetch git merge origin/master
Tags:
git push --tags
Reset working copy:
git clean -fd git checkout .
Rebase pattern
TODO: personally test this sequence.
Check out branch we want to (eventually) deliver to. Double check its all up to date.
git checkout desuapp-codefoo git pull
Create new branch and check out.
git checkout -b task101
- ( Do actual work, make commits, etc. )
Update local copy of branch we want to deliver to.
git fetch origin
Do the magic rebase thing - rewrite history and send current target branch back in time.
git rebase origin/desuapp-codefoo
Switch to the branch we want to deliver to and get it up to date.
git checkout desuapp-codefoo git pull
Bring over our work in to the local copy of the delivery target branch.
git rebase task101
- ( Verify the differences between local and remote copies )
Send it out into the big wide world with the happy satisfaction of a job well done.
git push
Remove directory from history
git filter-branch --tree-filter 'rm -rf com.example.foo' HEAD rm -rf .git/refs/original rm -rf .git/logs/ git gc
References
Merge / Rebase
- http://stackoverflow.com/questions/804115/git-rebase-vs-git-merge
- A Rebase Workflow for Git
- Intro to rebase
- Avoiding Git Disasters