4

I have some files and a folder in Master branch. I am wondering what are the commands to move those individual files from Master branch to the inside of the folder in Master branch.

Should I clone the Master branch from gitlab to my local first?

Thanks in advance!

MAMS
  • 419
  • 1
  • 6
  • 17

2 Answers2

7

I guess you have cloned the repository locally, i.e. you did git clone git@gitlab.com:sume-user/some-repo.git

Then you just need to move those files, commit and push those changes

git mv old/path new/path
git commit -m "Some commit message"
git push

git mv old/path new/path is just a short form for

mv old/path new/path
git add new/path
git rm old/path

or, in case you don't have other changes locally

mv old/path new/path
git add .
Manuel Schmidt
  • 2,178
  • 2
  • 15
  • 19
5

If your GitLab web has the Web-IDE, you can use it to move folders without local clone. Click on Web-IDE on the repository main window.

Right click on the folder and select rename/move ( for example moving src to old/src)

Remember to commit changes

enter image description here

Alireza Fattahi
  • 42,517
  • 14
  • 123
  • 173
  • This doesn't seem to be answering the actual question, which isn't about moving or renaming folders but about the best way of moving a bunch of files into a folder – Motorhead Apr 28 '22 at 00:42
  • This worked for me - nice easy soution. You just need to hit source control on the left menu and commit the changes. – jmiller Jul 09 '23 at 07:44