DEV Community

Discussion on: Resolving tricky situations with git reset and rebase ๐Ÿงถ

Collapse
 
tonymet profile image
Tony Metzidis

great article

in case your changes are patches and not files, another good trick is

git add -p

A good example would be if you added some experimental methods in 3 different files, and you want to control which commits those changes get applied to.

Finally, it's important to remember your reflog

git reflog |head
471af9a HEAD@{0}: commit (initial): init

that keeps tracks of the history of all refs (e.g. "master" and all branches are refs). That way you can easily reset to a ref from a few days ago in case you forget which commit was kosher.

Collapse
 
aleccool213 profile image
Alec Brunelle

Another two fantastic under-rated commands.