Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What I like about SourceTree is the ability to pick individual lines and „hunks“ to stage, as I often have changes and some debugging stuff sprinkled into some files (think printf). Since it‘s not explicitly mentioned, I assume this is a pretty standard feature? I wouldn’t mind switching away from SourceTree, it crashes often.


You can do this on the terminal with `git add -p` but yes it’s always slightly more intuitive with a proper editor (I mainly use the many-times-forked GitX for this)


The one built into vs2022 has this and works pretty well if you happen to use it already. I think vscode has many of these features but I haven't tried it there. Otherwise I'd say look at gitkraken (free for personal use I think) or sublime merge if you really want performance.

Personally I use sublime merge or command line for everything. The sublime merge/text interactions are really nice, being able to right click in a diff and have it open the file at the line. You can try them for free forever but the price may be a deterrent since the dark theme for merge is locked behind a license key.


I used `git gui` for that (not sure how "native" to git is it, though), and recently switched to `gitg` for both looking at tree and committing individual lines. Can't compare them with SourceTree, though, since haven't used that.

Also, when on command-line, I recently discovered `git add -i` for interactive mode (asks you about individual hunks and lets you "split" them), and `git add -e` (lets you edit the patch however you want).


It's possible with various tools:

1. git add -i or -p 2. History edits using interactive rebases 3. Using tools like lazygit or git-ui 4. Using stacked patch tools like stgit or topgit 4. Here is my favourites: Use magit on emacs or fugitive on vim

The last one on magit and fugitive feels like interactive addition is closer to editing 2 files.


Indeed most git GUIs can do this. git-gui (built-in), VSCode, Sublime Merge, Git Extensions to name a few.


You can also do this with Tower — here's an example: https://imgur.com/a/fVPZJL1

I work at Tower and I recently put together a "Tower versus Sourcetree" comparison page (there are many features that Sourcetree is missing): https://www.git-tower.com/compare/sourcetree/

I hope you give Tower a try! :)


git add -p

or by right clicking in the diff pane in git-gui (which is almost never mentioned).

Although I use the cli more, gitk and git-gui solve all my GUI needs.


Yes: `git add --patch`


Give `tig` a try.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: