How to commit and push selected files, but not everything in Git

I have a git repository with two branches: develop

and master

. I work mostly on develop

, and when the files are ready (sometimes it's not so stigmatized to this statement), I merge them into a branch master

to put them into production. Take a look at this pic:

enter image description here

All of these files come from branch develop

and have been merged, but I only want to commit and push RepresentativeRestController.php

, but anytime I do right click => they are all included in commit. How do I get rid of, temporary, since they will be added later, the ones I don't want to include in the commit? I am using Smartgit as the GUI client for the Bitbucket repository. Any advice?

+3


source to share


2 answers


When you commit, the entire staged file is included in commit. If you want to exclude certain files from committing, unmount those files first.



I'm not sure how to do this with the Git UI you are using, but there must be a screen or something to manage the files with changes and which ones are not.

+3


source


Use terminal to commit the selected file: for example: you have 100 files (10 types)

git add *.*

whole file

git add *.jpg

all jpg files

$ git add .

# add only files created or modified to the index, not those that have been deleted

$ git add -u

# add to index only files deleted / modified, not created



you can use source tree for all git.

+4


source







All Articles