Correggere un commit in git: Difference between revisions

From RVM Wiki
Jump to navigation Jump to search
m Created page with "*Se si sbaglia il messaggio di commit e lo si vuole correggere: git commit --amend "My fixed commit message" * Se si vuole aggiungere un file ad un commit già eseguito, o si v…"
 
(No difference)

Latest revision as of 13:09, 11 January 2012

  • Se si sbaglia il messaggio di commit e lo si vuole correggere:
git commit --amend "My fixed commit message"
  • Se si vuole aggiungere un file ad un commit già eseguito, o si vogliono inserire dei files modificati
git add mynewfile
git commit --amend "My fixed commit message"

Attenzione, però, che in questo caso si creano problemi per un push. Infatti se si tenta un push, si ottiene un errore. Per poter continuare, fare prima un pull:

git pull

Se non si riesce a fare il pull, controllare .git/config e verificare i branch etc ...

Controllare, e poi fare il push

git push

Riferimenti