How can I push certain files to origin/master in Git?

  1. Create a new branch from master
  2. git checkout master
  3. git checkout -b new_branch
  4. Checkout just the file you want from your old branch
  5. git checkout old_branch path/to/some/file
  6. repeat as necessary for additional files
  7. Commit the files to your new branch
  8. git commit -a
  9. Push new branch to origin master branch
  10. git push origin new_branch:master

I solved my problem: (I was confused with git status response because it wasn't changed when I tried to add/commit files which were already there).Thanks to linuxdan and DaveZych and Temich.

git checkout -b NewBranch

After that I deleted all unnecessary files.

git rm --cache build/web/WEB-INF/classes/doggizz/utils/\*.class

Move back to master

git checkout master

(only disadvantage that those files were deleted when I moved back to master so I copied manually project file , I tried to stash before checkout but it didn't helped)

git merge NewBranch
git push

Tags:

Git

Push