Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to commit the staged files and excluding modified files

Tags:

git

I thought git commit will only commit the staged file to repo,

git ci a.txt

Then the modified a.txt (content: b) was committed to the repo, but not the staged a.txt (content: a)

So What's the command can git commits the staged file to repo , and keep the modified file as usual.

Thanks.

enter image description here

like image 805
newBike Avatar asked Jan 16 '14 06:01

newBike


1 Answers

When you do git commit (without a pathspec) you only commit staged changes. So, in order not to commit the new changes to a.txt, instead of doing git ci a.txt just do git commit, which will not commit the new unstaged changes.

like image 73
Alex Siri Avatar answered Sep 28 '22 10:09

Alex Siri