0

I want to commit a number of files that have changed. Yet, there is one file, which should be excluded only for this commit. Thus, I looking for something like

git commit -m "Many changes." * -ignore src/later.txt

2 Answers2

5

Just do git add . then git reset the file you don't want

git add .
git reset src/later.txt
git commit -m "Many changes"
eftshift0
  • 26,375
  • 3
  • 36
  • 60
  • Wouldn't `git add -u` would be better here? – Paolo Apr 23 '20 at 16:41
  • I don't know if the file the OP is talking about is tracked or not, actually... at least my _hunch_ from reading is that it's a tracked file. But anyway, without knowing if it is tracked or not, we can't really be sure if `-u` would pull it off or not. – eftshift0 Apr 23 '20 at 17:21
0

to do this you should unstage that particular file using "git reset --pathoffile" then go ahead commit others

raven404
  • 1,039
  • 9
  • 14