我尝试修改文件并同时将其移动到另一个文件夹,但不知何故git没有跟踪该文件的移动。它将其视为新文件。
christoph@christoph-laptop-16-04-2:~/Documents/Uni/Modules/2016-04-18 Numerik/Vorlesungsfolien$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Offene Fragen.md
no changes added to commit (use "git add" and/or "git commit -a")
christoph@christoph-laptop-16-04-2:~/Documents/Uni/Modules/2016-04-18 Numerik/Vorlesungsfolien$ git mv Offene\ Fragen.md ..
christoph@christoph-laptop-16-04-2:~/Documents/Uni/Modules/2016-04-18 Numerik/Vorlesungsfolien$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
renamed: Offene Fragen.md -> ../Offene Fragen.md
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: ../Offene Fragen.md
christoph@christoph-laptop-16-04-2:~/Documents/Uni/Modules/2016-04-18 Numerik/Vorlesungsfolien$ git add -A
christoph@christoph-laptop-16-04-2:~/Documents/Uni/Modules/2016-04-18 Numerik/Vorlesungsfolien$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: ../Offene Fragen.md
deleted: Offene Fragen.md
christoph@christoph-laptop-16-04-2:~/Documents/Uni/Modules/2016-04-18 Numerik/Vorlesungsfolien$ git commit -m "Added questions regarding Numerik."
[master a2e17f5] Added questions regarding Numerik.
2 files changed, 4 insertions(+), 2 deletions(-)
create mode 100644 Uni/Modules/2016-04-18 Numerik/Offene Fragen.md
delete mode 100644 Uni/Modules/2016-04-18 Numerik/Vorlesungsfolien/Offene Fragen.md
在这种情况下,有没有办法跟踪文件的移动? (当然,除了进行2次提交。也许在移动文件后提交一次,然后在修改文件后修改提交也可以。)