git: Cherry-pick code fragments from base revision (partial revert)


If you've made a mistake on part of a file and want to only revert portions of it rather than the whole file, you can do that using:

git checkout -p the_filename.ext

The -p flag allows you to step through each code chunk and actively select or ignore changes you want to undo since the last commit.

[ Source ]


Post a Comment

Leave your thoughts ...
If you are having trouble with copy/pasting in comments, you need to sign in or click 'Preview'. For more information about this Firefox bug, see here.

Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog