1

-EMERGENCY GIT COMMANDS-

Amend to rebuild commits.

The following command: “git commit –amend” will add the changes added previously to the last commit and it will offer to change the message if it’s required.

Git reset and reflog.

All the changes, even deleted commits are saved and to access that list it’s why “git reflog” exist, there we can see all the history of commits we have made.
In case it is wanted to go back to some commit that has been deleted then both commands, “git reflog” and “git reset –SOFT or –Hard” are necessary. Of course, resetting it’s a bad practice due to the alternate of the history, especially reset in hard mode.

Git grep and log.

The command “git grep wordToFind” will search in all the files the wished word if it’s added “-n” or “-c”, it will show the number line the word it’s founded and the amount of times the word was used.
In the case of looking coincidence in the commits then we use the command “git log -S “wordToFind” and Git will show all the commits related to that word.

Escribe tu comentario
+ 2