0

A developer wants to commit only certain files. But unable to commit as it requires clean(staged and committed all changes) working directory.

Bhakti Bhoj
  • 11
  • 1
  • 4

2 Answers2

2

When in doubt, just use the command prompt. “git add ” for the things to stage and “git commit -m ” after you’ve added them all.

If you have changes locally, you can “git stash”, make your changes and then “git stash pop” after you committed them.

jjj
  • 111
  • I want to push only some of the modified files to remote. And other files should remain unstage. – Bhakti Bhoj Jun 14 '19 at 12:56
  • 1
    @bh22 that’s exactly what jjj is explaining. git add the files you want to push, git commit, then git push. The other files will remain unstaged. – Stephen Kitt Jun 14 '19 at 16:09
0

To commit certain files, you need to do the following things as shown below:

git status 
git add . // for all files
git add "fileName" // for a specific file
git commit -m "the Message" //change message for commit 

Then, just use git push command.