DEV Community

Discussion on: 4 Useful Solutions to Common Git Problems

Collapse
 
skyboyer profile image
Yevhen Kozlov • Edited

Thanks for raising this topic. People typically underestimate git's flexibility.

Let me add few notes.

git add -p + git commit may be replaced with single git commit -p. Actually -p is applicable to most file-level commands like add, commit, checkout and stash save.

As for git rebase master: if we are talking about "re-apply my comment on most recent code" then it would probably more handy git pull --rebase origin master: it's like 2-in-1: git fetch + git rebase.

And it were not noted here but I believe it's also handy: git log with keys -S and -G may really help to find out "when it has been introduced?" or "where it has been removed?". annotate works on per-line basis that is not granular enough.

Another thing is git bisect: once you have some shell command that fails or succeeds and you'd like to find out commit that "broke things" it's fast way to go.