Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

how to recovery the file to commit after stop track it in sourcetree?

st d May 21, 2015

in sourcetree, I stop tracked a file yestoday, but I want to commit it to repository. how can i do it? please help me 

3 answers

0 votes
Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2015

(Assuming you right-clicked on a file and selected the "Stop tracking" option.)

This command stages a change that deletes the file (line with a red minus in the beginning in the pending changes), but leaves the file intact on your disk (it shows as an untracked file):

image2015-5-22 11:10:26.png

You can undo this by right-clicking on the line with the red minus and selecting "Discard".

EDIT: once this deletion is committed, this is how to undo it:

  1. Select the commit where you removed the file.
  2. On the bottom, right-click on the file name, select Log selected.
  3. In the Log window, select the last revision where the file was still there (probably the second commit from the top), right-click on it and select "reset to commit".
  4. The file now shows up as an uncommitted change, commit it.
st d May 21, 2015

I commit this red minus file to repository. I can't find "discard" option.

Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2015

I edited the answer to show the recovery steps for this case as well.

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2015

I think in step 3 you want to "Reverse commit".

Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2015

He does not necessarily want to revert the other changes in the commit.

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2015

True, but "reset to commit" will change the history, which will be a problem if he's pushed.

Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2015

This reset is not that reset. :) It resets a file to a certain state, not the commit history to an earlier point.

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2015

Ah, not clear that you meant to right click on the FILE rather than the COMMIT: "select the last revision where the file was still there ... right click on it".

Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 24, 2015

Step 3 happens in the file history window. (Opened in step 2.)

0 votes
st d May 21, 2015

Execute a command to stop tracing a file

0 votes
Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2015

What exactly do you mean by "I stop tracked a file"?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events