Wednesday, January 15, 2014

Git rebase without commiting changes

If you are working on tons of changes (like switching from bootstrap v2 to v3), you might need to rebase often in order to keep up to date with your colleagues' changes. Working with visual studio helps keeping track of the added files, but if you need to, you can git add --all to add any new files. After that, create a temporary commit:

git commit -m 'tempCommit' // Create a temp commit 
git pull --rebase origin master // Rebase to the latest master 

Fix any conflicts if needed (and do "git rebase --continue" if conflicts occur) and then soft reset the head to discard the temp commit.

git reset HEAD~1

No comments: