Reputation:
I moved a .txt file to another sub-folder in the parent folder using git mv someName.txt NameOfFolder/someName.txt
function but I cant seem to get it back, only way I can succeed is by doing it by File Explorer. What do I use to move it to previous folder/parent folder. I'm only learning Git now as you can see.
Upvotes: 1
Views: 5094
Reputation: 3075
You can reference the parent folder with ..
.
Navigate to the NameOfFolder
and run mv someName.txt ../someName.txt
See example:
parentfolder $ mv file.txt subfolder/file.txt
parentfolder $ cd subfolder
subfolder $ ls
file.txt
subfolder $ mv file.txt ../file.txt
subfolder $ ls
// empty
subfolder $ cd ..
parentfolder $ ls
subfolder
file.txt
Upvotes: 2
Reputation: 11072
Do a git reset if haven't made any commit after you moved the file and you made no other changes to the repository
git reset --hard HEAD
Or you can do
git mv yourfile path/to/destination
Upvotes: 0