User login


Git undo part of a commit

To revert an entire commit.

git checkout <file>
re-checkout <file>, overwriting any local changes

Should be able to git add changed files that you are interested in committing the revised changes and git commit --amend

Git revert a commit

To revert a very simple commit, this is enough:

git revert ba24a3fdeae4a3a034691308171d798d2ddbf93e

Where that long string of characters is the ID of the commit you are reverting.

For a more careful approach to a complex revert, read on...

(if things go horribly wrong we can throw out this branch-- note we may have to commit everything in the branch in order to switch to another branch and delete this one with git branch -D revert-alpha-6

Undo that SVN add

In Subversion, to cancel an svn add example_folder command before committing to the repository, do not use svn delete or svn remove or made-up stuff like undo or cancel.

Use the svn revert command:

svn revert --recursive example_folder

And all will be well.

Update: Commenter says this can lose local changes. Not sure about that, but my use case was indeed to get rid of everything so i didn't care. And i'm on Git now.

Syndicate content