How do you restructure working directory files in a git repository

0 votes
How do you restructure working directory files in a git repository?
Nov 26, 2019 in DevOps Tools by anonymous
• 19,610 points
3,356 views

1 answer to this question.

0 votes

If we have a file called 'myfile.txt' to restructure/move in the sub directory 'mydir' under git's working directory; rather than cut and paste(manual mv command), we can use 'git mv ' 

e.g. 'git mv myfile.txt mydir'. 

This will move the file to provided directory and marks it to 'staging'.

If we use 'git status' command now, it will display changes available to commit e.g. 'renamed: myfile.txt -> mydir/myfile.txt'.

Now using git commit command create this restructuring permanently within the repository.

If we move file/folder out of the working directory (basically like permanently removing a committed file from the repository) then post movement we have to use 'git add -u' command to mark it staging then commit command to create it permanently.

answered Nov 26, 2019 by anonymous
• 59,230 points

Related Questions In DevOps Tools

0 votes
0 answers

How do you restructure working directory files in a git repository?

How do you restructure working directory files ...READ MORE

Nov 26, 2019 in DevOps Tools by anonymous
• 19,610 points
615 views
0 votes
0 answers
+1 vote
1 answer

i have a pyhton code in my git/git repository how to build that code in jenkins

Follow these steps @Bhaskar: Step 1: Open the Jenkins ...READ MORE

answered Oct 14, 2019 in DevOps Tools by Kalgi
• 52,350 points
843 views
0 votes
0 answers

How do you handle failed deployments in a CI/CD pipeline without disrupting production?

This question basically seeks to know how ...READ MORE

3 days ago in DevOps Tools by Anila
• 1,320 points
33 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,987 views
+2 votes
1 answer
0 votes
1 answer

How to get the current status of a local repository in Git?

Using 'git status' command in the repository ...READ MORE

answered Nov 26, 2019 in DevOps Tools by Sirajul
• 59,230 points
717 views
0 votes
1 answer

What are the steps to unstage files and discard changes in the working directory?

If the git status command displays 'myfile.txt' ...READ MORE

answered Nov 26, 2019 in DevOps Tools by Sirajul
• 59,230 points
1,982 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP