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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

In Sourcetree, how can I get a copy of a previous version of a file from the remote repository?

I am a newbie.  I just installed the latest version of Sourcetree to be a GUI for Git. .  I do not know much about Git, FYI.  I see in the Git toolbar a Fetch icon.  I looked in the documentation for what Fetch does and did not find anything?  I wondered if Fetch will do the job?  I see a dashed circle around the Fetch icon.  What is the significance of a dashed circle versus a solid circle?  (The remote repository I am working with is https://bitbucket.org/uiprose/alpha_system/src/master/

)

1 answer

1 accepted

0 votes
Answer accepted
minnsey Atlassian Team Feb 18, 2019

Hi
Fetch simply pulls any changes from the remote repository into your local copy, i.e. the .git folder. It will not change your local working copy, hence the dotted circle, to do that you need to Pull.

To view the contents of a remote version of a file in Sourcetree.

In the File Status view select the Show All filelisting option, then find the file of interest. Alternatively use the Search option on the same screen.

Once you can select your required file use the context menu to Log Selected... this will give you a history of the file. 

You can then select the version you want and use the context menu to Open Selected this will create a temporary copy of the file at that revision and open it for you.

I found the following web page to be very useful.  It includes a discussion of:The major difference between Git and any other VCS (version control system) .

https://git-scm.com/book/en/v1/Getting-Started-Git-Basics
Here are some highlights from the above page:

 

The major difference between Git and any other VCS (version control system) (Subversion and friends included) is the way Git thinks about its data.

 

Now, pay attention. This is the main thing to remember about Git if you want the rest of your learning process to go smoothly. Git has three main states that your files can reside in: committed, modified, and staged. Committed means that the data is safely stored in your local database (repository). Modified means that you have changed the file but have not committed it to your database yet. Staged means that you have marked a modified file in its current version to go into your next commit snapshot.

 

This means that Commit does not modify the remote repository by itself, only when you do a Push at the same time or at a later time as a Commit.
I thought that Commit makes your changes visible to other people, but I was wrong.  Push is what accomplishes that.  Pull is what merges other peoples changes into the files you have modified (but not pushed) and what copies the changes others have made to files you have not modified.

The following web page explains more about what commit really does.

https://git-scm.com/book/en/v1/Git-Basics-Recording-Changes-to-the-Repository
The above web page is part of a useful chapter that is introduced here:
https://git-scm.com/book/en/v1/Git-Basics

The following web page explains what push and pull really do.https://git-scm.com/book/en/v1/Git-Basics-Working-with-Remotes

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

5,816 views 4 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you