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

I need to replace a whole directory in a branch

fcarino March 30, 2018

I have a new editor that I need to replace.

If in a branch I have some called EDITOR (folder with subfolders and files).

How do I replace the folder EDITOR with the new EDITOR - keeping same names.

I only want to commit and change this folder (and not other changes to other files).

I just want to force the new folder changes - hopefully al done at once.

3 answers

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 3, 2018

I've just seen Lonnie's response and looks like we both understood something different. Please clarify your message if you needed something else so we can help you better! :)

Regards,

Ana 

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 3, 2018

 

Hi Felipe! If my understanding is correct, you want to replace the existing folder with a new one, keeping the same old files inside the new one. Assuming that's what you want, it won't be possible to do that with Git, as that's not how Git works. I'm also assuming that you're using Git as it's the more widespread option and you didn't specify otherwise.

Git doesn't know about folders, in Git you can not have an empty folder for example. What Git "sees" is the file, if you change a file from one folder to another, Git will see that the name of the file was changed from oldfolder/file.txt to newfolder/file.txt. For Git, renaming a folder is to rename the path of every individual file inside it. 

Having said that, this doesn't look like a Bitbucket question so I've moved it to the Git category where you'll be able to receive further explanations if you need them :)

Hope that helps!

Ana

0 votes
Lonnie
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 3, 2018

Hello Felipe, I am not sure I fully understand the situation. At first, I thought you might want to just rename the directory. This sounds like you want to replace the folder and its contents.  I suggest the following:

 

  1. Rename EDITOR to EDITOR.OLD
  2. Move/Drag and Drop new EDITOR Folder into the correct location of Repo
  3. git add --all
    git commit -am "<commit message>"
  4.  Check your local Repo to make sure this what you want and if so: 
    git push
  5. Once satisfied with Repo configuration and your build has been tested, you can delete the old folder

 

Hope this helps

 

Thanks 

Lonnie

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events