In source tree, I am 4 behind after resetting to an earlier commit, so the other commits from origin are still present. How can I 'tell' origin that I don't want them?
-
You need to be more clear with your question, may be take an example and explain. – user376507 Feb 20 '14 at 17:52
2 Answers
If the commits are in origin, you will always be behind. Your local repo only knows this because of the "remote tracking branch" referred to as origin/branchname
. If you want, you can delete this with git branch -rd origin/branchname
. Strictly speaking this is unnecessary since the current location of your branch does not contain the commits from origin.

- 81,660
- 23
- 145
- 268
-
-
@user3331009 Apparently I misunderstand your question. You stated that you reset to an earlier commit. If that is the case, then your local branch will not contain those commits. It might help if you give some ascii art or a screenshot of `gitk` to show us what your repo is like. – Code-Apprentice Feb 20 '14 at 04:54
Assuming you have
commit_id3
commit_id2
commit_id1
with commit_id3 being the latest commit.
It depends on how you have performed the reset operation. If you have done git reset <commit_id1>
then the HEAD will be pointing to that particular commit_id1, but all the files that you have committed later(as part of commit_id2 and commit_id3) will appear as modified files when you do a git status
. If you do a git reset --hard <commit_id1>
, the only difference is the changes done in commit_id2 and commit_id3 are lost. Looks like in your case you need git reset --hard <commit_id1>

- 2,004
- 1
- 19
- 31
-
so, but after that I still have the same Problem, 4 behind (because I did not always push all the commits to origin while working on local, and now I have inconsistencies in both local and origin, but rolling back to an earlier one that is just on local always gives the divergent ones on origin, how do I ignore them?) – user3331009 Feb 20 '14 at 15:54
-
and yes, usually the other commits should get lost, but now they don't and I don't know how to get rid of them. – user3331009 Feb 20 '14 at 16:02