For commands like restore, it is useful to separate paths from options with '--', e.g. git restore -s <commit_id> -- <path1> <path2>. Shell completion relies on it.
For recipe 3, if not to add -m, this opens editor. In a case of multiline commit message (typical for a complex project) this is much handier.
Recipe 9: it's useful to note exceptions to cleaning, like: git clean -dfx -e .vscode.
For recipe 11: git log works with commit ids as well, so, git log -p <id> may suggest what was the branch to restore. Anyway, well, good messages are useful... but I'm regularly encountering the same commit sequence over different branches.
I am curious why would I add the -x and then manually add -e.
This is the case build artifacts (all of them - object files, libraries, autogenerated sources, etc.) are present in the same directory as the working copy. Normally, they are all in .gitignore. Heavy cleaning from build results require deleting all of them. But, if IDE and other locals aren't a level upper, they are to be saved from deletion.
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
A good intro, just a few notes:
For commands like
restore, it is useful to separate paths from options with '--', e.g.git restore -s <commit_id> -- <path1> <path2>. Shell completion relies on it.For recipe 3, if not to add
-m, this opens editor. In a case of multiline commit message (typical for a complex project) this is much handier.Recipe 9: it's useful to note exceptions to cleaning, like:
git clean -dfx -e .vscode.For recipe 11:
git logworks with commit ids as well, so,git log -p <id>may suggest what was the branch to restore. Anyway, well, good messages are useful... but I'm regularly encountering the same commit sequence over different branches.Good notes👍. For recipe 9, I am curious why would I add the
-xand then manually add-e. Looks like a lot of workThis is the case build artifacts (all of them - object files, libraries, autogenerated sources, etc.) are present in the same directory as the working copy. Normally, they are all in .gitignore. Heavy cleaning from build results require deleting all of them. But, if IDE and other locals aren't a level upper, they are to be saved from deletion.