Github - 无法同步此分支[包含日志]

时间:2013-12-18 12:03:39

标签: github

我可以从其他计算机成功上传Github上的文件。

但是,它无法同步上传的文件。我正在起诉Windows 8,下面的图像出现了。

enter image description here

所以,我输入了shell并键入了“git status”,下面的行出现了。

C:\Users\Playmobs Jake\Documents\GitHub\bridge [master +47 ~68 -0 !]> g
# On branch master
# Your branch and 'origin/master' have diverged,
# and have 1 and 4 different commits each, respectively.
#   (use "git pull" to merge the remote branch into yours)
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working dire
#
#       modified:   .classpath
#       modified:   .project
#       modified:   AndroidManifest.xml
#       modified:   README.md
#       modified:   gen/com/playmobs/bridge/BuildConfig.java
#       modified:   gen/com/playmobs/bridge/R.java
#       modified:   gen/se/emilsjolander/stickylistheaders/R.java
#       modified:   proguard-project.txt
#       modified:   project.properties
#       modified:   res/drawable/bluetooth_selector.xml
#       modified:   res/drawable/border.xml
#       modified:   res/drawable/border_topdown.xml
#       modified:   res/drawable/dialog_selector.xml
#       modified:   res/drawable/endcall_selector.xml
#       modified:   res/drawable/friend_call_selector.xml
#       modified:   res/drawable/friend_dialog_call_selector1.xml
#       modified:   res/drawable/hide_selector.xml
#       modified:   res/drawable/keypad_selector.xml
#       modified:   res/drawable/listview_selector.xml
#       modified:   res/drawable/mute_selector.xml
#       modified:   res/drawable/profile_edit_selector.xml
#       modified:   res/drawable/round_shape.xml
#       modified:   res/drawable/scrollbar_vertical_thumb.xml
#       modified:   res/drawable/search_invite_selector.xml
#       modified:   res/drawable/sign_confirm.xml
#       modified:   res/drawable/sign_number.xml
#       modified:   res/drawable/speaker_selector.xml
#       modified:   res/layout/callscreen.xml
#       modified:   res/layout/fragment_friend.xml
#       modified:   res/layout/fragment_recent.xml
#       modified:   res/layout/fragment_search.xml
#       modified:   res/layout/fragment_setting.xml
#       modified:   res/layout/friend_dialog.xml
#       modified:   res/layout/friend_item_row.xml
#       modified:   res/layout/main.xml
#       modified:   res/layout/notice_item_row.xml
#       modified:   res/layout/option_dialog.xml
#       modified:   res/layout/profile_activity.xml
#       modified:   res/layout/recent_item_row.xml
#       modified:   res/layout/recent_list_header.xml
#       modified:   res/layout/ringscreen.xml
#       modified:   res/layout/search_item_row.xml
#       modified:   res/layout/signauth_activity.xml
#       modified:   res/layout/signup_activity.xml
#       modified:   res/layout/start_activity.xml
#       modified:   res/values-v11/styles.xml
#       modified:   res/values-v14/styles.xml
#       modified:   res/values/colors.xml
#       modified:   res/values/strings.xml
#       modified:   res/values/styles.xml
#       modified:   src/com/playmobs/bridge/call_activity.java
#       modified:   src/com/playmobs/bridge/main_activity.java
#       modified:   src/com/playmobs/bridge/phoneFunction.java
#       modified:   src/com/playmobs/bridge/profile_activity.java
#       modified:   src/com/playmobs/bridge/ring_activity.java
#       modified:   src/com/playmobs/bridge/signauth_activity.java
#       modified:   src/com/playmobs/bridge/signup_activity.java
#       modified:   src/com/playmobs/bridge/start_activity.java
#       modified:   src/com/playmobs/widget/ViewTimer.java
#       modified:   src/com/playmobs/widget/fragment_Friend.java
#       modified:   src/com/playmobs/widget/fragment_Recent.java
#       modified:   src/com/playmobs/widget/fragment_Search.java
#       modified:   src/com/playmobs/widget/fragment_Setting.java
#       modified:   src/com/playmobs/widget/friend.java
#       modified:   src/com/playmobs/widget/friendlist_Adapter.java
#       modified:   src/com/playmobs/widget/recentCallEntry.java
#       modified:   src/com/playmobs/widget/recentlist_Adapter.java
#       modified:   src/com/playmobs/widget/searchlist_Adapter.java
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       .settings/
#       bin/
#       lint.xml
#       res/drawable-hdpi/Thumbs.db
#       res/drawable-xhdpi/Thumbs.db
#       res/drawable-xhdpi/bridge_logo.png
#       res/drawable-xhdpi/dot_.png
#       res/drawable-xhdpi/dot_selected.png
#       res/drawable-xhdpi/dropout_chenk_btn.png
#       res/drawable-xhdpi/dropout_chenk_btn_selected.png
#       res/drawable-xhdpi/dropout_comfirm_red_btn.png
#       res/drawable-xhdpi/friends_reset_btn.png
#       res/drawable-xhdpi/friends_reset_btn_selected.png
#       res/drawable-xhdpi/intro_logo.png
#       res/drawable-xhdpi/intro_signin_btn.png
#       res/drawable-xhdpi/intro_signin_btn_selected.png
#       res/drawable-xhdpi/intro_signup_btn.png
#       res/drawable-xhdpi/intro_signup_btn_selected.png
#       res/drawable-xhdpi/manual_1_image.png
#       res/drawable-xhdpi/manual_2_image.png
#       res/drawable-xhdpi/manual_3_image.png
#       res/drawable-xhdpi/playmobs_logo.png
#       res/drawable-xhdpi/playmobs_logo2.png
#       res/drawable/border2.xml
#       res/drawable/drop_out.xml
#       res/drawable/friends_sync.xml
#       res/drawable/signin_selector.xml
#       res/drawable/signup_selector.xml
#       res/layout/announcement.xml
#       res/layout/announcement_low.xml
#       res/layout/change_picture.xml
#       res/layout/company_introduction.xml
#       res/layout/drop_out.xml
#       res/layout/help.xml
#       res/layout/help_low.xml
#       res/layout/help_out.xml
#       res/layout/intro.xml
#       res/layout/intro_sub1.xml
#       res/layout/intro_sub2.xml
#       res/layout/intro_sub3.xml
#       res/layout/intro_sub4.xml
#       res/layout/splash.xml
#       res/layout/sqlist_low.xml
#       res/layout/sync_friends.xml
#       src/com/bridge/
#       src/local/
#       src/org/
no changes added to commit (use "git add" and/or "git commit -a")
C:\Users\Playmobs Jake\Documents\GitHub\bridge [master +47 ~68 -0 !]>

你能看出问题是什么吗?

1 个答案:

答案 0 :(得分:1)

这与git在您将文件从一个分支推送/拉/合并到另一个分支时保护您不会覆盖数据的方式有关。

在Windows 8计算机上,(本地)主分支上有4个新提交。在远程主分支origin / master上,有一个新的提交等着你。

听起来你正试图从origin / master拉到本地master,并且它无法同步来自origin / master的新提交,因为它会覆盖你的新提交(或者至少不知道如何混合他们在一起)。

这里有一些选项,但主要的想法是你想要将origin / master中的更改合并到本地master中,并且不会丢失任何本地提交。

您的两个基本选项是rebase or merge。要从命令行执行此操作,请运行

git checkout [yourbranch]
git pull --rebase origin master

你也可以运行

git checkout [yourbranch]
git merge origin/master

这两种方法中的任何一种都应该安全地混合两个分支,并允许您将新的提交推回到origin / master。您应该会收到有关如何排列提交的信息,您可以运行git log以确保一切正常。

如果出现问题,请使用git rebase --abort来废除rebase。如果您合并并想要返回,请运行git log并找到合并提交。然后在合并提交之前复制commit 的长sha号,然后运行git reset [commit sha]

您可能会遇到问题,因为您在本地主副本上有未提交的更改(也称为“脏工作树”)。要解决此问题,请提交更改,然后执行rebase / merge,或stash未提交的更改以供日后使用。要存储,请在终端中运行git stash命令,这将保存并隐藏所有未提交的更改,让您安全地合并/重新绑定。稍后运行git stash apply会显示您的隐藏更改,并且它们将像您粘贴的git status输出一样返回。