I want to a move folder and files in it to a new folder. Both folder name and file names have changed.
Dir1
file11
file12
TO
Dir2
file21
file22
I also want to keep the history.
Can I do this in one commit? Or I need the following 2 steps?
git mv Dir1 Dir2
commit and push
git mv Dir2/file11 Dir2/file21
git mv Dir2/file11 Dir2/file22
commit and push
Yes you can do this in only one commit with:
git mv Dir1 Dir2
git mv Dir2/file11 Dir2/file21
git mv Dir2/file11 Dir2/file22
commit and push
You can also do this in two commits and squash them using git rebase -i HEAD~3
if you prefer.