Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
391 views
in Technique[技术] by (71.8m points)

git - Sourcetree and staging changed files

I am new to Sourcetree. I have created my git repository and committed the files I mean to have in there (only a small subset of the directory). Then I have edited code and change some of those files.

Now I'm looking for the command that isn't there: "stage all files that are already in the repository that have been changed since the last commit." I shouldn't have to do this manually, and I don't want to stage any new files. Okay, so what's the right way to do this? Is it somehow happening automatically? I'm sure this is obvious to the initiated, but I couldn't readily find it in the documentation.

question from:https://stackoverflow.com/questions/65929980/sourcetree-and-staging-changed-files

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Look at the pending files in Sourcetree:

enter image description here

Modified tracked files are marked with a yellow box with three dots, like my a. Untracked files are marked with a blue box with a question mark, like my b.

So, to add to the next commit only the modified tracked files, check the checkboxes for only the modified tracked files.

But perhaps this is what you mean by "manually" as being what you would prefer not to do? Then choose Actions > Open In Terminal and say git add -u. If you now come back to Sourcetree and Refresh, you will see that exactly what you wanted to have happened has happened: only the modified tracked files have been staged. Now make your commit.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...