I have a lot of files that I have worked on. Is it possible to stash just specific uncommitted files or is it all or nothing? What would be the best way to only commit certain files and leave the others? Would that be just to stage the specific files and commit them?
I am using Windows 10 and version 3.4.7.
Thanks.
Hi @Greg Davis,
Welcome to Atlassian Community!
Git stash is an all or nothing command, so you cannot stash just a subset. Git commit allows you to select the files you want to commit, you just have to use git add to specify the files that you want to commit.
Thanks @Mikael Sandberg Thanks for the reply. The reason I ask is that I have 12 files but I only want to commit and push two of them.
How do I do the git add in Sourcetree?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In Sourcetree you have the option to stage specific files, and when you commit it will only include your staged files. This is the equivalent to using git add from the command line. Have a look at Create a file, add it locally, and push it to Bitbucket for a simplified example.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Then when I commit the staged files, I can then stash the unstaged files?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you want your commit to be available on the remote repository, then yes, you need to push it. There should be a checkbox that allow you to push automatically when you make your commit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.