2

I am working off a github branch, call it "main12"

I then do a git checkout -b newFeature.

I do some work on newFeature

I then need to go back to main12 to do some work

I close down Xcode. I switch to main12 via terminal git checkout main12 Open xcode and verify xcode is on the main12 branch.

All my changes made in newFeature are now in my main12 branch

What gives? Did I miss a step? Why wouldn't my code in main12 be the way I left it?

4

2 回答 2

0

您是否提交或隐藏对 newFeature 所做的更改?如果不是,则该命令可能git checkout main12已失败。仔细观察该命令的命令行输出并进行验证。

在签出另一个分支之前,您对当前分支所做的任何更改都应提交或隐藏(暂时丢弃,在需要时将其存储回来)。

在结帐 main12 之前尝试以下命令

git commit -am "some commit message here"

于 2012-09-19T18:19:40.077 回答
0

您可能忘记在分支之前checkout提交代码。main12目前,您应该有未提交的代码(在 Xcode 中除了文件名之外标记为 M/A)。您可以切换回newFeature分支,提交代码,然后切换回main12分支。

于 2012-09-19T18:19:49.483 回答