From: Daniel H. <dhe...@te...> - 2008-12-28 06:05:23
|
On Sat, 27 Dec 2008, Tobias C. Rittweiler wrote: > "Nikodemus Siivola" <nik...@ra...> writes: > >> * This branch is not a clean line of development: things like "Forgot >> to change INTERN* in package-data-list." don't belong on a Git branch >> proposed for merging. Sometimes things like that end up in CVS since >> we're human and screw up occasionally, but as long as the branch is in >> Git the mistake can be fixed and history left cleaner. > > How, BTW.? Until someone else fetches your branch, you are free to rewrite history. You can even rewrite history after they fetch; but its generally poor ettiquette and they may have to do extra work to accept your change. * If you want to fix your last commit, `git commit --amend` ("Amend last commit" radio button in git-citool) * If you want to fix an earlier commit, here are some tools. # gitk --all& # update frequently to avoid confusion # git checkout -b tmp <last-good-hash> # git cherry-pick <single-commit> # good for reordering patches # git merge --squash <several-commits-to-merge> # ... # git branch -D master # Delete the old master # git branch -m master # Call this branch master # git push --force <somewhere> master * If you botch your repository, `git fsck --lost-found` and browse the objects left in .git/lost-found/commit until you find your old master. In a long-lived repository, it is good to run git-gc occasionally (during safe times) to reduce the # of lost-found items. HTH, Daniel |