restore project after git conflict [duplicate]
This question already has an answer here:
Undo git pull, how to bring repos to old state
9 answers
Me and my friend were working on a branch. When my friend completed his work and push his work on the branch that we were working on.
Now I was about to pull the work done by him but instead of pulling from the branch that he was working on I mistakenly pulled from the master branch.
and there occurs a conflict. I know how to fix a conflict but I don't want to merge master into my working branch. therefore to rollback I used following commands
git reset .
git checkout -- .
this restored all the files back to the latest local commit. (I think so)
But when I do git status it show some untracked files and also displays a message that says "All conflicts fixed but you are still merging."
Now I don't know what should I do to make sure that the whole project directory is restored to its original state before pulling the master branch.
git
marked as duplicate by phd, Community♦ Nov 13 '18 at 9:06
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Undo git pull, how to bring repos to old state
9 answers
Me and my friend were working on a branch. When my friend completed his work and push his work on the branch that we were working on.
Now I was about to pull the work done by him but instead of pulling from the branch that he was working on I mistakenly pulled from the master branch.
and there occurs a conflict. I know how to fix a conflict but I don't want to merge master into my working branch. therefore to rollback I used following commands
git reset .
git checkout -- .
this restored all the files back to the latest local commit. (I think so)
But when I do git status it show some untracked files and also displays a message that says "All conflicts fixed but you are still merging."
Now I don't know what should I do to make sure that the whole project directory is restored to its original state before pulling the master branch.
git
marked as duplicate by phd, Community♦ Nov 13 '18 at 9:06
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
When you typegit statuswhat is the latest commit? When you pull something, you have to merge it with your local repo (which is done automatically), so if the last commit is the merge of your current local branch and the remote main branch, you would have to reset the head to the state before the merge, and then pull the changes from the correct branch.
– wdc
Nov 12 '18 at 8:10
stackoverflow.com/search?q=%5Bgit%5D+undo+merge
– phd
Nov 12 '18 at 11:11
add a comment |
This question already has an answer here:
Undo git pull, how to bring repos to old state
9 answers
Me and my friend were working on a branch. When my friend completed his work and push his work on the branch that we were working on.
Now I was about to pull the work done by him but instead of pulling from the branch that he was working on I mistakenly pulled from the master branch.
and there occurs a conflict. I know how to fix a conflict but I don't want to merge master into my working branch. therefore to rollback I used following commands
git reset .
git checkout -- .
this restored all the files back to the latest local commit. (I think so)
But when I do git status it show some untracked files and also displays a message that says "All conflicts fixed but you are still merging."
Now I don't know what should I do to make sure that the whole project directory is restored to its original state before pulling the master branch.
git
This question already has an answer here:
Undo git pull, how to bring repos to old state
9 answers
Me and my friend were working on a branch. When my friend completed his work and push his work on the branch that we were working on.
Now I was about to pull the work done by him but instead of pulling from the branch that he was working on I mistakenly pulled from the master branch.
and there occurs a conflict. I know how to fix a conflict but I don't want to merge master into my working branch. therefore to rollback I used following commands
git reset .
git checkout -- .
this restored all the files back to the latest local commit. (I think so)
But when I do git status it show some untracked files and also displays a message that says "All conflicts fixed but you are still merging."
Now I don't know what should I do to make sure that the whole project directory is restored to its original state before pulling the master branch.
This question already has an answer here:
Undo git pull, how to bring repos to old state
9 answers
git
git
edited Nov 12 '18 at 8:14
kowsky
3,0371224
3,0371224
asked Nov 12 '18 at 7:45
Amarjit Singh
692319
692319
marked as duplicate by phd, Community♦ Nov 13 '18 at 9:06
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by phd, Community♦ Nov 13 '18 at 9:06
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
When you typegit statuswhat is the latest commit? When you pull something, you have to merge it with your local repo (which is done automatically), so if the last commit is the merge of your current local branch and the remote main branch, you would have to reset the head to the state before the merge, and then pull the changes from the correct branch.
– wdc
Nov 12 '18 at 8:10
stackoverflow.com/search?q=%5Bgit%5D+undo+merge
– phd
Nov 12 '18 at 11:11
add a comment |
When you typegit statuswhat is the latest commit? When you pull something, you have to merge it with your local repo (which is done automatically), so if the last commit is the merge of your current local branch and the remote main branch, you would have to reset the head to the state before the merge, and then pull the changes from the correct branch.
– wdc
Nov 12 '18 at 8:10
stackoverflow.com/search?q=%5Bgit%5D+undo+merge
– phd
Nov 12 '18 at 11:11
When you type
git status what is the latest commit? When you pull something, you have to merge it with your local repo (which is done automatically), so if the last commit is the merge of your current local branch and the remote main branch, you would have to reset the head to the state before the merge, and then pull the changes from the correct branch.– wdc
Nov 12 '18 at 8:10
When you type
git status what is the latest commit? When you pull something, you have to merge it with your local repo (which is done automatically), so if the last commit is the merge of your current local branch and the remote main branch, you would have to reset the head to the state before the merge, and then pull the changes from the correct branch.– wdc
Nov 12 '18 at 8:10
stackoverflow.com/search?q=%5Bgit%5D+undo+merge
– phd
Nov 12 '18 at 11:11
stackoverflow.com/search?q=%5Bgit%5D+undo+merge
– phd
Nov 12 '18 at 11:11
add a comment |
1 Answer
1
active
oldest
votes
The right way would have been a git merge --abort; see this answer.
Since git says All conflicts fixed but you are still merging., i.e. the merge flag is still set, you can still use git merge --abort to reset to the state before the pull.
git merge --abortfixed the message But there are still some untracked files. Do I have to delete them manually.
– Amarjit Singh
Nov 12 '18 at 8:45
Were there changes in themasterbranch that were not part of your shared feature branch when you accidentaly merged it? Do you know if the untracked files originate frommasteror from your branch? And are you sure you're on top of your original branch?
– kowsky
Nov 12 '18 at 8:50
Yes, I am sure that I am on top of my local branch (not remote). also the untracked files originate from master
– Amarjit Singh
Nov 12 '18 at 9:03
1
Then it should be safe to remove them, since you do not want to add them to your branch. They can be added if you ever merge withmaster. But you have to see for yourself if the files are needed in the current state of your branch or not.
– kowsky
Nov 12 '18 at 9:05
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The right way would have been a git merge --abort; see this answer.
Since git says All conflicts fixed but you are still merging., i.e. the merge flag is still set, you can still use git merge --abort to reset to the state before the pull.
git merge --abortfixed the message But there are still some untracked files. Do I have to delete them manually.
– Amarjit Singh
Nov 12 '18 at 8:45
Were there changes in themasterbranch that were not part of your shared feature branch when you accidentaly merged it? Do you know if the untracked files originate frommasteror from your branch? And are you sure you're on top of your original branch?
– kowsky
Nov 12 '18 at 8:50
Yes, I am sure that I am on top of my local branch (not remote). also the untracked files originate from master
– Amarjit Singh
Nov 12 '18 at 9:03
1
Then it should be safe to remove them, since you do not want to add them to your branch. They can be added if you ever merge withmaster. But you have to see for yourself if the files are needed in the current state of your branch or not.
– kowsky
Nov 12 '18 at 9:05
add a comment |
The right way would have been a git merge --abort; see this answer.
Since git says All conflicts fixed but you are still merging., i.e. the merge flag is still set, you can still use git merge --abort to reset to the state before the pull.
git merge --abortfixed the message But there are still some untracked files. Do I have to delete them manually.
– Amarjit Singh
Nov 12 '18 at 8:45
Were there changes in themasterbranch that were not part of your shared feature branch when you accidentaly merged it? Do you know if the untracked files originate frommasteror from your branch? And are you sure you're on top of your original branch?
– kowsky
Nov 12 '18 at 8:50
Yes, I am sure that I am on top of my local branch (not remote). also the untracked files originate from master
– Amarjit Singh
Nov 12 '18 at 9:03
1
Then it should be safe to remove them, since you do not want to add them to your branch. They can be added if you ever merge withmaster. But you have to see for yourself if the files are needed in the current state of your branch or not.
– kowsky
Nov 12 '18 at 9:05
add a comment |
The right way would have been a git merge --abort; see this answer.
Since git says All conflicts fixed but you are still merging., i.e. the merge flag is still set, you can still use git merge --abort to reset to the state before the pull.
The right way would have been a git merge --abort; see this answer.
Since git says All conflicts fixed but you are still merging., i.e. the merge flag is still set, you can still use git merge --abort to reset to the state before the pull.
answered Nov 12 '18 at 8:17
kowsky
3,0371224
3,0371224
git merge --abortfixed the message But there are still some untracked files. Do I have to delete them manually.
– Amarjit Singh
Nov 12 '18 at 8:45
Were there changes in themasterbranch that were not part of your shared feature branch when you accidentaly merged it? Do you know if the untracked files originate frommasteror from your branch? And are you sure you're on top of your original branch?
– kowsky
Nov 12 '18 at 8:50
Yes, I am sure that I am on top of my local branch (not remote). also the untracked files originate from master
– Amarjit Singh
Nov 12 '18 at 9:03
1
Then it should be safe to remove them, since you do not want to add them to your branch. They can be added if you ever merge withmaster. But you have to see for yourself if the files are needed in the current state of your branch or not.
– kowsky
Nov 12 '18 at 9:05
add a comment |
git merge --abortfixed the message But there are still some untracked files. Do I have to delete them manually.
– Amarjit Singh
Nov 12 '18 at 8:45
Were there changes in themasterbranch that were not part of your shared feature branch when you accidentaly merged it? Do you know if the untracked files originate frommasteror from your branch? And are you sure you're on top of your original branch?
– kowsky
Nov 12 '18 at 8:50
Yes, I am sure that I am on top of my local branch (not remote). also the untracked files originate from master
– Amarjit Singh
Nov 12 '18 at 9:03
1
Then it should be safe to remove them, since you do not want to add them to your branch. They can be added if you ever merge withmaster. But you have to see for yourself if the files are needed in the current state of your branch or not.
– kowsky
Nov 12 '18 at 9:05
git merge --abort fixed the message But there are still some untracked files. Do I have to delete them manually.– Amarjit Singh
Nov 12 '18 at 8:45
git merge --abort fixed the message But there are still some untracked files. Do I have to delete them manually.– Amarjit Singh
Nov 12 '18 at 8:45
Were there changes in the
master branch that were not part of your shared feature branch when you accidentaly merged it? Do you know if the untracked files originate from master or from your branch? And are you sure you're on top of your original branch?– kowsky
Nov 12 '18 at 8:50
Were there changes in the
master branch that were not part of your shared feature branch when you accidentaly merged it? Do you know if the untracked files originate from master or from your branch? And are you sure you're on top of your original branch?– kowsky
Nov 12 '18 at 8:50
Yes, I am sure that I am on top of my local branch (not remote). also the untracked files originate from master
– Amarjit Singh
Nov 12 '18 at 9:03
Yes, I am sure that I am on top of my local branch (not remote). also the untracked files originate from master
– Amarjit Singh
Nov 12 '18 at 9:03
1
1
Then it should be safe to remove them, since you do not want to add them to your branch. They can be added if you ever merge with
master. But you have to see for yourself if the files are needed in the current state of your branch or not.– kowsky
Nov 12 '18 at 9:05
Then it should be safe to remove them, since you do not want to add them to your branch. They can be added if you ever merge with
master. But you have to see for yourself if the files are needed in the current state of your branch or not.– kowsky
Nov 12 '18 at 9:05
add a comment |
When you type
git statuswhat is the latest commit? When you pull something, you have to merge it with your local repo (which is done automatically), so if the last commit is the merge of your current local branch and the remote main branch, you would have to reset the head to the state before the merge, and then pull the changes from the correct branch.– wdc
Nov 12 '18 at 8:10
stackoverflow.com/search?q=%5Bgit%5D+undo+merge
– phd
Nov 12 '18 at 11:11