正在加载视频...

视频加载失败

I betcha didn’t know about git add in patch mode!

35,642 次观看 • 2 年前 •via X (Twitter)

9 条评论

Mark Erikson 的头像
Mark Erikson2 年前

This is by far the biggest reason I've always preferred using a Git GUI for commits in most cases - the ability to visually pick and choose which hunks (or individual lines) get added, rather than using a TUI. Fork's great. Used to use SourceTree. VS Code's UI is awkward.

Liran Tal 的头像
Liran Tal2 年前

patch mode is great but how cool that you can do exactly that in VS Code's UI? :-)

Mx Corey Frang 的头像
Mx Corey Frang2 年前

I almost always use -p. I actually have an alias that tracks new files without adding the lines so -p can catch them I use this step as a sort of self code review and reminder to remove console statements etc before it gets pushed

Andrej Maznevski 的头像
Andrej Maznevski2 年前

git add -p is quite useful to interactively review and stage changes chunk by chunk. Note: This only stages modifications to existing files, not new files, meaning that they won't be added

Mike Behnke 的头像
Mike Behnke2 年前

So glad to see this featured! I've been telling coworkers and anyone who will listen about using patch for years. Even have it aliased to `git ap`. Next do `git add -i` (or `--interactive`) for more command line fun, can do patch, but also revert, add files and more.

Andy Hails 👨‍💻 的头像
Andy Hails 👨‍💻2 年前

"that was my band name in high school" actually made me do a spit take with my coffee! 😂

Kevin Moritz 的头像
Kevin Moritz2 年前

I did know about it, and once I found out about it I have never gone back.

Sergii Shymko 的头像
Sergii Shymko2 年前

IntelliJ IDEs allow you to pick and choose which changes to include in a commit. Uncheck the checkbox of unwanted changes from the diff viewer. Using this all the time along with moving some changes out to a separate Change Set.

Joe Attardi 的头像
Joe Attardi2 年前

Stage this hunk baby

相关视频