restore project after git conflict [duplicate]












-2















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.










share|improve this 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 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
















-2















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.










share|improve this 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 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














-2












-2








-2








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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


















  • 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
















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












1 Answer
1






active

oldest

votes


















2














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.






share|improve this answer





















  • 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










  • 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 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




















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














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.






share|improve this answer





















  • 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










  • 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 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


















2














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.






share|improve this answer





















  • 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










  • 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 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
















2












2








2






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.






share|improve this answer












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.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 '18 at 8:17









kowsky

3,0371224




3,0371224












  • 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










  • 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 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




















  • 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










  • 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 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


















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





這個網誌中的熱門文章

Academy of Television Arts & Sciences

L'Équipe

1995 France bombings