Thursday, May 17, 2018

What to do if only want to submit some of the changed files

Assume that you have changed file1, file2, file3 and file4, but you only want to commit file1 and file2, follow the this procedure.

1. Use git add to add individual files to be committed.
     git add file1
     git add file2

2. The commit the changes.
    git commit -s

3. Then stash all the changes.
    git stash

4. Now git checkout other files which have been changed to make the work space clean
    git checkout -- file3
    git checkout -- file4

5. Now your workspace should be clean. Git review the commit
    git review

6. Simply do git stash pop to get changes to file3 and file4 back.
    git stash pop







No comments:

Post a Comment