2013-05-29 10 views
20

Ho eseguito git status eUndo diversi commit in Git che non hanno spinto a distanza

# On branch master 
# Your branch is ahead of 'origin/master' by 4 commits. 
# (use "git push" to publish your local commits) 
# 
# Changes not staged for commit: 
# (use "git add <file>..." to update what will be committed) 
# (use "git checkout -- <file>..." to discard changes in working directory) 
# 
#  modified: app/views/layouts/_header.html.erb 
# 
no changes added to commit (use "git add" and/or "git commit -a") 

voglio annullare tutte le 4 i depositi e le modifiche non messo in scena per la prima di impegnarsi commettere al mio repository remoto. Come posso fare questo?

risposta

24

Ciò buttare via tutte le modifiche locali nella struttura di lavoro e le quattro più recenti commit:

git reset --hard HEAD~4 
27

È inoltre possibile eseguire le seguenti operazioni per ripristinare HEAD del telecomando:

git reset --hard <REMOTE>/<BRANCH_NAME> 

Es:

git reset --hard origin/master 
+0

L'ho usato per questo sito repo http://azdam.com e grazie. –

Problemi correlati