-2
大家好我現在正面臨着git上的壓力問題。當我嘗試修改特定分支時,git也將更改保存在其他分支中。這些是我的終端記錄:Git:OS X上分支機構的問題
Pro-di-Mirko:gitfun mirko$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: .DS_Store
modified: gitfun.swift
Pro-di-Mirko:gitfun mirko$ git branch
addingFunction
master
Pro-di-Mirko:gitfun mirko$ git checkout addingFunction
A .DS_Store
M gitfun.swift
Switched to branch 'addingFunction'
Pro-di-Mirko:gitfun mirko$ git status
On branch addingFunction
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: .DS_Store
modified: gitfun.swift
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: gitfun.swift
Pro-di-Mirko:gitfun mirko$ git add -A
Pro-di-Mirko:gitfun mirko$ gi status
-bash: gi: command not found
Pro-di-Mirko:gitfun mirko$ git status
On branch addingFunction
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: .DS_Store
modified: gitfun.swift
Pro-di-Mirko:gitfun mirko$ git branch
addingFunction
master
Pro-di-Mirko:gitfun mirko$ git checkout master
A .DS_Store
M gitfun.swift
Switched to branch 'master'
Pro-di-Mirko:gitfun mirko$ git branch
addingFunction
master
Pro-di-Mirko:gitfun mirkodevita$
在我迅速的文件,如果我籤不同的分支沒有任何反應,該文件保持一致
看來你對'git add'有什麼誤解。這個階段文件將被提交給你當前所在的分支。所以你需要添加'git commit'來使它成爲分支的一部分。 – v01pe