Git rollback my commits

I commit my and push them to Git. My colleagues commit their changes. I commit more of my changes.

I have been told that my changes cannot be tested for This release and have to go in the next release. I have to back out all my changes and only my changes. How can I do that?

I use tortoise when pushing or puling my changes into Git. I am using windows XP machine.

Yes, I pulled my colleagues work before pushing my commits.

I have to mention though that my changes were for completely different files. None of my colleagUes touched them.

It is just one branch, which is the integration branch.


Why simply not using the git revert command ?

Lets say initial integrated Repo is I and when your commit is Y and later your collegues commit is C. So may be the line of development looks like this. And the file system is F at present.


And as you mentioned

I have to mention though that my changes were for completely different files. None of my colleagUes touched them.

So you could keep on doing reset HEAD~1 till you reach I, the commit before you made any changes. Say there are two commits after your commit. You could use this to reach commit I.

git reset HEAD~3

And as your files are preserved this may look like


Now you could just delete your files from the system and add the files of your collegues (to the index, its already there on FileSystem) and then do a commit. And now the dev line may look like without your changes.


This is not a recommended way. The recommended way to do it is using

 git revert HEAD^

Though I have never used it,so to cant tell.

EDIT: Another way of doing it. Find the "SHA KEY" of the your commit "Y" and commit just before that "I". It can be done using

git log

Lets say the for Y key is: 7a2ab465aad23dc66a23ade897deb65a5bf9419d And for I key is: 906488ac2d5a8468d725351df80e3b0f6338c9be Make tags for both commits like

git tag Intercommit -a 906488ac2d5a8468d725351df80e3b0f6338c9be
git tag YourCommit -a  7a2ab465aad23dc66a23ade897deb65a5bf9419d

Checkout intercommit using

git checkout Intercommit

Then rebase the repo using

git rebase --onto HEAD YourCommit master

Now the line of dev will look like


You can find more about rebasing and rewriting one commit on


Need Your Help

In Metaio Creator - How would I prevent fullscreenVideo from auto playing?

javascript metaio

I'm posting here because the Metaio forums are awful and nobody responds so I figured it can't hurt to try here. Metaio Creator is an augmented reality software program.

How to manage a product backlog with multiple applications

tfs azure-devops agile

I am about to start working on a project that will be made up of a Windows Store, Windows Phone and Web application with each of these applications connecting to a Web API. To manage these I will be