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

Keep history when moving/renaming files

amo_developer February 8, 2020

 

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

myapplication/test/file1.kt

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

myapplication/test1/file1.kt

 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.

sourcetree.png

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events