Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make git add by patch by default

Tags:

git

How can I make it so that executing git add will include the -p flag by default?

like image 807
shoe Avatar asked Sep 05 '26 02:09

shoe


1 Answers

There's no way to change defaults of commands in git. You can add your own alias though. For instance, I like to use this one:

git config --global alias.patch 'add -p'

# git add -p file.txt
git patch file.txt
like image 119
Kevin Hoerr Avatar answered Sep 07 '26 14:09

Kevin Hoerr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!