martes, 24 de noviembre de 2020

GIT Demystifying part 7 Smash commit, Correct commit where some files has been forgotten

GIT Demystifying part 7 

Smash Commit

Correct commit where some files has been forgotten

Some times we need to return to X commit which don´t have change that are on a recent commit, So integrate the last change to X commit, and clean the posterior commits. its like a smash operation of commits.

  We have three commits, on the thirth commit we realize that the changes can be integrated to the first commit, we can achieve this task with git reset --soft HEAD~2. , and the state of commit 3 will be translated to commit 1 and be ready to commit or more changes. 


When first commit the state only has the basic changes.



2 Two commits later, we have a new file2, and three change on file1, we want to add this changes to commit 1, and if necesary do more changes and do a new commit. the commits 2 and 3, never mind any more.



The final state one the 4 Commit were made.

Secuence diagram of the operations.

Procedure on command line




eot

No hay comentarios:

Publicar un comentario