我在git中有一些奇怪的行为,我创建了一个分支。复制文件夹以添加文件夹并将更改提交到分支。我然后检查主人和文件夹列在那里虽然它在这一点上没有跟踪。这不一定是一个问题,因为我可以删除未跟踪的文件。
有没有其他人遇到这个?
创建空的repo添加文件并提交
[bash]# git init
Initialized empty Git repository in /usr/src/config/.git/
[bash]# echo 'test' > test
[bash]# git add test
[bash]# git commit -m 'Initial Commit'
[master (root-commit) 76fcfe1] Initial Commit
Committer: hmmhesays
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
If the identity used for this commit is wrong, you can fix it with:
git commit --amend --author='Your Name <you@example.com>'
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 test
[bash]# ls -lah
total 16K
drwxr-xr-x 3 root root 4.0K Mar 13 15:57 .
drwxr-xr-x 10 root root 4.0K Mar 13 15:56 ..
drwxr-xr-x 8 root root 4.0K Mar 13 15:57 .git
-rw-r--r-- 1 root root 5 Mar 13 15:57 test
创建并结帐分支
[bash]# git branch test_branch
[bash]# git checkout test_branch
Switched to branch 'test_branch'
[bash]# ls -lah
total 16K
drwxr-xr-x 3 root root 4.0K Mar 13 15:57 .
drwxr-xr-x 10 root root 4.0K Mar 13 15:56 ..
drwxr-xr-x 8 root root 4.0K Mar 13 15:57 .git
-rw-r--r-- 1 root root 5 Mar 13 15:57 test
[bash]# git branch
master
* test_branch
复制文件夹。添加并提交。
[bash]# cp -a /etc etc
[bash]# git add etc
[bash]# git commit -m 'branch commit'
[test_branch 49ff84f] branch commit
Committer: hmmhesays
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
If the identity used for this commit is wrong, you can fix it with:
git commit --amend --author='Your Name <you@example.com>'
957 files changed, 108376 insertions(+), 0 deletions(-)
create mode 100644 etc/.pwd.lock
/* Truncated output */
create mode 100644 etc/yum/version-groups.conf
[bash]# ls -lah
total 20K
drwxr-xr-x 4 root root 4.0K Mar 13 15:58 .
drwxr-xr-x 10 root root 4.0K Mar 13 15:56 ..
drwxr-xr-x 8 root root 4.0K Mar 13 15:58 .git
drwxr-xr-x 71 root root 4.0K Mar 2 13:16 etc
-rw-r--r-- 1 root root 5 Mar 13 15:57 test
分支机构的结帐主文件和文件夹是
[bash]# git checkout master
Switched to branch 'master'
[bash]# ls -lah
total 20K
drwxr-xr-x 4 root root 4.0K Mar 13 15:58 .
drwxr-xr-x 10 root root 4.0K Mar 13 15:56 ..
drwxr-xr-x 8 root root 4.0K Mar 13 15:58 .git
drwxr-xr-x 31 root root 4.0K Mar 13 15:58 etc <-- Directory shows up in master after branch commit even though it is untracked.
rw-r--r-- 1 root root 5 Mar 13 15:57 test
[bash]# git ls-files
test
[bash]#