0

Suppose that you have a repository in bitbucket and you need to create a new folder inside the bitbucket repository and move your files there. The way that I am moving it removes history, all the previously saved files in the repository and replaces the new one.

I found some similar questions here but they are old and they did not work out for me.

Please advise!

Edited: the wat that I am doing :

git init
git add .

git commit -m "my new commit"

git remote add origin https://.....

git push -f origin master

This removes any other code.

oxr463
  • 1,573
  • 3
  • 14
  • 34

1 Answers1

0

Git tracks exactly what matters, namely "collections of files".

git mv oldname newname is pretty much like mv oldname newname; git add newname; git rm oldname

It mostly depends on your client I think to track renaming of files. Sometimes it works, but if the content is changed drastically then it considers it as a new file.

An other question on here that discusses this issue.

What's the purpose of git-mv?

Update: https://git.wiki.kernel.org/index.php/GitFaq#Why_does_Git_not_.22track.22_renames.3F

As a very special case, 'git log' version 1.5.3 and later has '--follow' option that allows you to follow renames when given a single path.

Mail by Linus on this topic.

Git has a rename command git mv, but that is just for convenience. The effect is indistinguishable from removing the file and adding another with different name and the same content.

Rohan Bojja
  • 655
  • 1
  • 16
  • 35