Do it one at a time in git

git add -p allows you to navigate through each modified file one at a time.

I need a similar version; however, it should allow you to create one file at a time. I want to be able to create and provide a commit message.

+3
source share
3 answers

I think you need the -o switch, for example:

git commit -o file1
+5
source

So you want to do this?

git add <file1>
git commit [-m "message"]
git add <file2>
git commit [-m "message"]
...
+3
source

Here's the quickie I use to punch all changed elements from git state. We do the fix one at a time, so I can add comments for each of them.

for each_git_file in
`git status | egrep 'modified|new file' | awk -F: '{print $2}' | sed 's/[\W\.]*//'`;
 do
     git commit -o $each_git_file;
 done
0
source

Source: https://habr.com/ru/post/1796102/


All Articles