I’m stuck at this point where me and my teammate working on the master branch and we both pushed the code but I didn’t pull the changes and again pushed the code so here i’m now I can’t pull or push the code.. what should i do?
            Asked
            
        
        
            Active
            
        
            Viewed 1,694 times
        
    1
            
            
        - 
                    What's the output of `git status`? – mprivat Nov 27 '20 at 20:00
2 Answers
2
            This might look intimidating but bare with me:
- Get the hash of the stable common commit between you and master: git log
- Soft reset your commits to convert them to unstaged changes.
: git reset --soft [hash]
- Stash you current working changes: git stash
- Fetch latest changes from remote: git fetch
- Pull latest changes from remote: git pull
- Bring back your work from the stash: git stash applyorgit stash pop
- Resolve any conflicts and recommit your work: git commit ...
- Push your changes to remote: git push
From now own, you should remember to do all your work on a separate branch and then merge them onto master.
 
    
    
        Mahmoud
        
- 9,729
- 1
- 36
- 47
0
            
            
        Checkout a new branch.
git checkout -b tmp
Delete your current master.
git branch -D master
Checkout master from origin
git checkout master
Merge your branch and handle conflicts
git merge tmp
 
    
    
        wickdninja
        
- 949
- 1
- 10
- 15
