So, I started with an empty repository and wanted to copy an existing Git repository there. If I initially pushed the wrong existing repository to that new, empty repository, how would I go about reversing or undoing that initial push so I could push the proper existing repository to my new one?
            Asked
            
        
        
            Active
            
        
            Viewed 139 times
        
    0
            
            
        - 
                    duplicate https://stackoverflow.com/questions/22682870/git-undo-pushed-commits/31937298#31937298 – jo_ Jan 29 '18 at 15:11
1 Answers
1
            
            
        You can simply force push the correct existing repository to the remote one. Everything that is there will be overwritten:
git push -f
 
    
    
        Christos Batzilis
        
- 352
- 1
- 3
- 12
- 
                    So, I did git push -f in the correct repository (and I made sure its origin was the remote repository I wanted to overwrite) and it said "everything up-to-date" but the remote repository was not overwritten, it still had the old repository in there. Do you know why? – user3505195 Jan 30 '18 at 00:11
- 
                    So you run "git remote show origin" and both Fetch and Push URL point to the correct repository? – Christos Batzilis Jan 30 '18 at 22:12
- 
                    
