3 ms·
Exactly what I was thinking. I'd have done: git fetch git stash git pull --rebase branch-name git stash apply All this cp business struck me as a bit
by bobwaycott 15y ago
Exactly what I was thinking. I'd have done:
git fetch
git stash
git pull --rebase branch-name
git stash apply
All this cp business struck me as a bit of not understanding how to properly work with git. I've never had my work clobbered by following the strategy above. But I also don't go very long between commits on my working branch.
- mainguy 15y agoYour workflow is a little overcomplicated.. I think the following will produce identical results: git pull --rebase branch-name
- jrockway 15y agoHe is using "git stash" to create a commit object for his uncommitted changes, giving him more documentation in the event that Something Goes Wrong. Git will never throw away your data, but you might get into a weird mental state and type a command that throws away your data. By creating a commit object, you can always get back to that state, and you have a little one-line note-to-self that helps you not get into a weird mental state. I personally do a "real" commit before rebase, but "git stash" is really the exact same thing. I guess "git stash pop" is less scary than "git rebase HEAD^". Either way, you can always undo that operation via the reflog.