Do they belong to you? Claim these comments.
bartman
Is this you? Claim Profile »
9 months ago
in http://adam.blog.heroku.com/past/2008/5/15/more_git_techniques/ on Adam @ Heroku
Restore a file to repository version
git: git checkout -f file
Set some changes aside to work on something else:
svn: svn diff > /tmp/path ; svn revert -R .
git: git checkout -f file
Set some changes aside to work on something else:
svn: svn diff > /tmp/path ; svn revert -R .
1 year ago
in My Git Workflow on Languages of the real and artificial
I love the diagrams!
One unmentioned commit management feature is `git commit --amend` which would allow you to update the last commit with new edits. If you're familiar with `git rebase -i` squashing, then this is like squashing your index into the last commit. You could also amend with the working files by using `git commit --amend -a` or providing specific files on the command line.
I think both `git stash` and `git commit --amend` have their uses, and I use them both in my workflow.
Finally, I would also like to mention that `git add -i` has a hidden feature of being able to stage individual lines of change, not complete files. If there is some debug code in your file, you can commit everything else. You can also use `git gui` to stage individual "hunks" (blocks of a diff) for commit.
-Bart
One unmentioned commit management feature is `git commit --amend` which would allow you to update the last commit with new edits. If you're familiar with `git rebase -i` squashing, then this is like squashing your index into the last commit. You could also amend with the working files by using `git commit --amend -a` or providing specific files on the command line.
I think both `git stash` and `git commit --amend` have their uses, and I use them both in my workflow.
Finally, I would also like to mention that `git add -i` has a hidden feature of being able to stage individual lines of change, not complete files. If there is some debug code in your file, you can commit everything else. You can also use `git gui` to stage individual "hunks" (blocks of a diff) for commit.
-Bart
1 year ago
in Frequent code checkpointing with git on Phil Dawes' Stuff
Have you tried using git-rebase -i ? You need to give it the commit id of the last commit before your string of changes. You can then tell it to combine all your commits into one (or more).
# *hack*
git commit -a -m"one"
# *hack*
git commit -a -m"two"
git rebase -i HEAD~2
# bring us an editor, select the "one" and "two" as squash, save, exit.
git log
An alternative workflow is to use git commit --amend. But this does not keep your micro history around. It just puts any recent changages into the last commit.
# *hack*
git commit -a -m"I am working on blah"
# *hack*
git commit --amend
...
-Bart
# *hack*
git commit -a -m"one"
# *hack*
git commit -a -m"two"
git rebase -i HEAD~2
# bring us an editor, select the "one" and "two" as squash, save, exit.
git log
An alternative workflow is to use git commit --amend. But this does not keep your micro history around. It just puts any recent changages into the last commit.
# *hack*
git commit -a -m"I am working on blah"
# *hack*
git commit --amend
...
-Bart