I'm using Git 1.7.4.1 on Mac 10.6.6. From the command line, how do I commit changes in only a single directory? I added the directory by doing:
git add my-dir
but doing
git commit -a
brings up a list of all changes in my repo, and I only want to commit and push changes from my-dir
.
Enter git add --all at the command line prompt in your local project directory to add the files or changes to the repository. Enter git status to see the changes to be committed. Enter git commit -m '<commit_message>' at the command line to commit new files/changes to the local repository.
Set “–assume-unchanged” to a path to exclude to check on git commit and it will exclude your file from git commit. You will need to use the git update-index and –assume-unchanged to exclude files from git commit.
Why does no one mention you can simply
git commit -m 'message' -- my-dir
It seems to me the OP isn't used to / doesn't like to use the staging area directly. This approach is also a lot safer to recommend without further context, because chances are that a defaault commit (of everything that's staged) will
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With