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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,244
Community Members
 
Community Events
184
Community Groups

sourcetree copy file from branch

Hi folks,

I'm trying to find a way to copy a specific file from one branch to another branch.

E.g. User 1 has been working in the Feature1 branch for some time. Now user2, working in the Feature2 branch, needs a file that exists in the Feature1 branch. Is there a "smooth" way of accomplishing this?

One "dirty" way of doing it would be to copy the file on the local machine (from working directory when the Feature1 branch is checked out) and paste it into the working directory for the Feature2 branch.

Best regards,
Per

3 answers

There is a clean and easy way to do this in Sourcetree without checking out:

  1. Select the commit
  2. Select one or more files in the commit, right-click them, and select "Log Selected". This opens a new window.
  3. Right-click the selected commit and select "Reset Files to This Commit".

Done!

Works great!  Thank you David

0 votes
Tim Crall
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.
Dec 03, 2015

Actually, I just realized, you can do this at the git command line with:

git checkout feature2 file2.xxx

I don't know a way to do it in SourceTree.

I am also interested how to do this in Sourcetree

0 votes
Tim Crall
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.
Dec 02, 2015

User 2 can checkout feature1 and copy the file somewhere - anywhere - it can even just be to a different name in the same working directory (where it will become an untracked file).  Then checkout feature2, copy the file back to its proper place and name, and do "git add".

Tim,

yes I know, that's the "dirty" way of doing it. I was thinking more of a "quick" way of doing it directly in SourceTree.

Thanks

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events