6

Got any git tips that everyone might not be aware of?

My tip is fixup and autosquash!

If I'm working in a branch with many commits and I notice that 5 commits ago I made a tiny mistake on commit 'abc123' then I'll just do `git commit --fixup abc123`.

It's similar to `--amend` but you can do it for any commit.

At first this would be a separate commit. But next time I wanna rebase I'd just do `git rebase -i --autosquash origin/master` and it'll be squashed into abc123

Some article that explains further details:
* https://gist.github.com/naviat/...
* https://blog.sebastian-daschner.com/...

After discovering I had been unaware of this for years I figure there must be other similar useful git things I might be unaware of

Comments
  • 0
    my tip is I commit often and actually never look at the commits or old code so why am I committing like a high school student presses Ctrl + s on their term paper
  • 1
    Unless I'm working on a very big project with multiple people, no one touches my branch ever so things only get pushed as huge blocks and don't expect anyone to dive through the actual branch.

    I hate so much spending more time in git bureaucracy than getting things done.

    In fact, I think it's gonna be one of my biggest pain points working in Nvidia.
  • 1
    Not much besides getting comfy using git stash and rebase
Add Comment