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
Community Members
Community Events
Community Groups

Keep history when moving/renaming files



Hi, I've been reading several questions but I can't get things clear. Let's say I have the following file structure:


and then I rename 'test' folder to 'test1', then  the current state is:


 What I found in source tree is that two sections appear: one with staged files, where the change has been detected as a rename and the other one with unstaged files.

After doing some tests, I've reached the conclusion that the only way to keep the history of the 'file1.kt' is to commit first the unstaged files, where the rename is detected and then commit the rest. Otherwise if I do it in just one commit, the change is detected as a delete and an addition, losing the history as a consequence. Can someone explain to me why it works like this and how should be done properly? In this thread they comment that renaming and editing shouldn't be done in the same commit, I don't know if it has some relation.


Thanks in advance.


0 answers

Suggest an answer

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

Bug Fix: Sourcetree for Windows authentication error when updating to app password

Hello Sourcetree users!!! With the recent removal of Bitbucket Cloud account passwords for app passwords (please see our Bitbucket Cloud community post for details on why we made this change for se...

60,654 views 127 26
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