martes, 1 de diciembre de 2020

GIT Demystifying part 9, git reset ADDRESS somefile

 

GIT Demystifying part 9

git reset [branch] somefile

  This will be something like git reset --hard [branch] somefile, but HEAD will not be moved. this way the file in the branch be copied in the actual index, ready to apply the commands:

git restore --staged file to unstage

git add file to update what will be commited.

git restore file to discard changes in working directory.

Secuence diagram



Procedure in command line to prepare the scenario of two commits with two files.


Now create the branches on the respective commits.


apply git reset principal file1


What we can do now is 
git restore --staged file1   to unstage this mean wd to file1:v2
git add file1    to update what will be commited
git restore file1  to discard changes in working directory

git restore --staged file1



git add file1, leaves the working directory with file1:v2 and nothing to commit.
git restore file1, leaves the working directory with file1:v1 and ready to commit.


eot


No hay comentarios:

Publicar un comentario