Reset File Changes with git

Publikováno: 25.4.2018

There are many different philosophies when it comes to code review but mine is fairly simple:  I like receiving early “work in progress” patches, I like to be positive in my code review messages, and if a patch is 90% there, I like to finish the patch myself so the project and contributor both benefit. […]

The post Reset File Changes with git appeared first on David Walsh Blog.

Celý článek

There are many different philosophies when it comes to code review but mine is fairly simple:  I like receiving early “work in progress” patches, I like to be positive in my code review messages, and if a patch is 90% there, I like to finish the patch myself so the project and contributor both benefit.

Every once in while, however, a patch comes in with an unrelated file change or code added to the wrong file, in which case I need to reset a file’s contents before the change commit.  You can restore a file’s contents before a patch with the following:

git reset origin/master path/to/file-to-be-changed.ext

Once this shell snippet is executed, the file’s contents are restored and can be re-commited to restore the file contents.

The post Reset File Changes with git appeared first on David Walsh Blog.

Nahoru
Tento web používá k poskytování služeb a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tímto souhlasíte. Další informace