Methods of changing the current working directory Since Bash knows the entire path of the current working directory, one can use the cd.. command to return to the parent directory of any current directory. One may also use the cd~ command (the character known as the tilde) to return to their home directory at any time.
Look at the server with a web browser and find the folder you want to copy. Right click on the folder you want to copy and select download as zip. In windows make a folder new_project. Copy folder from the zip file to new_project.
One of the nicest things about git is that you don't need to track file renames explicitly. Git will figure it out by comparing the contents of the files.
So, in your case, don't work so hard: Ref: Git mv docs
$ mkdir include
$ git mv common include
$ git rm -r common
$ git add include/common
Running git status
should show you something like this:
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# renamed: common/file.txt -> include/common/file.txt
#
git mv common include
should work.
From the git mv
man page:
git mv [-f] [-n] [-k] <source> ... <destination directory>
In the second form, the last argument has to be an existing directory; the given sources will be moved into this directory.
The index is updated after successful completion, but the change must still be committed.
No "git add
" should be done before the move.
Note: "git mv A B/
", when B
does not exist as a directory, should error out, but it didn't.
See commit c57f628 by Matthieu Moy (moy
) for Git 1.9/2.0 (Q1 2014):
Git used to trim the trailing slash, and make the command equivalent to '
git mv file no-such-dir
', which created the fileno-such-dir
(while the trailing slash explicitly stated that it could only be a directory).This patch skips the trailing slash removal for the destination path.
The path with its trailing slash is passed to rename(2), which errors out with the appropriate message:
$ git mv file no-such-dir/
fatal: renaming 'file' failed: Not a directory
Command:
$ git mv oldFolderName newFolderName
It usually works fine.
Error "bad source ..." typically indicates that after last commit there were some renames in the source directory and hence git mv
cannot find the expected file.
The solution is simple - just commit before applying git mv
.
Make sure you have added all your changes to the staging area before running
git mv oldFolderName newFoldername
git fails with error
fatal: bad source, source=oldFolderName/somepath/somefile.foo, destination=newFolderName/somepath/somefile.foo
if there are any unadded files, so I just found out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With