-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