i’m using git to manage my project, but i’m not much experienced in this kind of programs, so often i use them improperly(eg: i commit many (unrelated) changes in only one commit). I’m trying to using them better.
Btw i noticed that i started to develop an extension of my project that would be better fitting into a branch. So from the git gui i created a new branch that’s a copy of the master.
Now i want to revert the master to the last commit i made that it is not relevant to the project. I know what this commit is, but i don’t know how to revert all the commits from HEAD to this one, and i don’t know if this will influence the branch(it would be a real pain to lose all the new work..)
So, how can i do?
Ps: usually i use git gui, but i have no problem in using git bash. I use win7 and i’m managing an java android project in eclipse
If you have your branch created, change back to the master and reset it to the desired commit with
git reset --hard commitid. Now ‘master’ is set to this commit and branch still points to the commit you had it configured for previously.Branch names are references or alternate names for specific commits. reset allows you to change the commit that your reference points at and force the working tree to match (with –hard)