Twitter | Search | |
Kyle Shevlin
`git add -p` has become one of my favorite git commands. I recommend getting to know how it works, really helps you make better, atomic commits, even after doing bunch of work. πŸ‘
Reply Retweet Like More
Kyle Shevlin Jul 19
Replying to @kyleshevlin
There are a bunch of blogs you can find to read about it, but the gist is this: You run the command, you're now choosing what parts of your diff belong in this commit. Only those hunks get staged and committed, not whole files or your entire change.
Reply Retweet Like
chase adams Jul 19
Replying to @kyleshevlin @code
Did you know that you can *also* stage hunks (instead of entire files) in ?
Reply Retweet Like
Kyle Shevlin Jul 19
Replying to @chaseadamsio @code
I know, but I don't do any git through Code, i do it all from the CLI. It's how I learned, it's what I know Β―\_(ツ)_/Β―
Reply Retweet Like
Mark Erikson Jul 19
Replying to @kyleshevlin
Also one of the main reasons why I use a mix of a Git GUI tool (SourceTree) and the CLI. Picking lines and hunks is much easier through a UI, while other commands are easier via the CLI.
Reply Retweet Like
Kyle Shevlin Jul 19
Replying to @acemarke
You can split those hunks via the CLI as well. I was taught the CLI when I first started and it's all I know. I think I'd be lost in a GUI for a while until I learned it 😁
Reply Retweet Like
John Detlefs Jul 19
Replying to @kyleshevlin
`git commit -pv` is what I was taught and it works really well too :D
Reply Retweet Like
Kyle Shevlin Jul 19
Replying to @jdetle
It's the same, just adds verbosity 😁
Reply Retweet Like
Gunar Gessner Jul 19
Replying to @kyleshevlin
Ad: If you're seeing this and you use vim, try vim-fugitive for magical per-line staging.
Reply Retweet Like
Kyle Shevlin Jul 19
Replying to @gunar
Not on vim, I know how to save and close a file, a few other commands, but never have taken the time to use it enough to feel comfortable with it as my daily driver.
Reply Retweet Like
Arnaud πŸ¦₯ Jul 20
Replying to @kyleshevlin
Λ‹git rebase -i` is similar but for commits. I almost never push a branch without doing it first.
Reply Retweet Like