Git分支在原产地/主人之前

Git分支在原产地/主人之前

问题描述:

在Mac(而不是cli)上使用GitHub应用程序,我有这个错误,我不是很懂,也不知道如何解决。我知道它的错误,因为应用程序抛出一个窗口,上面写着“GitHub Error”。我需要将更改提交到下面列出的文件,但GitHub不会让我。当我按下提交按钮时,出现错误,似乎我无法做任何事情来解决它。任何帮助都会很棒。Git分支在原产地/主人之前

# On branch master 
# Your branch is ahead of 'origin/master' by 2 commits. 
# 
# 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: .gitignore 
# modified: haystack.egg-info/SOURCES.txt 
# modified: haystack/__init__.py 
# modified: haystack/search.py 
# modified: haystack/static/css/layout.css 
# modified: haystack/static/images/classifications/G.png 
# modified: haystack/static/images/classifications/M.png 
# modified: haystack/static/images/classifications/MA.png 
# modified: haystack/static/images/classifications/PG.png 
# modified: haystack/static/images/classifications/R.png 
# modified: haystack/static/images/classifications/X.png 
# modified: haystack/templates/base.jinja2 
# modified: haystack/templates/base_page.jinja2 
# modified: haystack/templates/search.jinja2 
# modified: haystack/templates/search_results_episodes.jinja2 
# modified: haystack/templates/view_episode.jinja2 
# modified: haystack/templates/view_program.jinja2 
# modified: haystack/view.py 
# 
# Untracked files: 
# (use "git add <file>..." to include in what will be committed) 
# 
# haystack/static/images/classifications/G.pxm 
# haystack/static/images/classifications/M.pxm 
# haystack/static/images/classifications/MA.pxm 
# haystack/static/images/classifications/NA.png 
# haystack/static/images/classifications/PG.pxm 
# haystack/static/images/classifications/R.pxm 
# haystack/static/images/classifications/X.pxm 
# haystack/static/images/haystack_logo.png 
# haystack/static/images/test_key_art.jpg 
# haystack/static/images/test_thumbnail.jpg 
# haystack/templates/view_asset.jinja2 
# haystack/templates/view_assets.jinja2 
no changes added to commit (use "git add" and/or "git commit -a") 
(256) 
+0

为什么你认为它是一个错误?它的'git status'!并可能在成功提交后出现 – 2012-07-27 11:49:42

+0

请将此问题添加到您如何编写'git commit'命令中。 – 2012-07-27 11:54:20

+0

这是一个错误吗?这似乎只是信息。 '你的分支在'origin/master'之前是2个提交'意味着你在你的本地分支中有两个提交,它们还没有被推送到远程分支。请告诉我们你什么时候收到错误,这是使用的git命令,错误信息是什么? – 2012-07-27 11:56:15

通过此消息,git告诉您,您的本地提交树在github.com的repo之前。

Repo in github Your local Y <-+ | | ahead of 2 commits Z <-+ | commit A <----------------> A | \ | \ B D B D |/ |/ C C | |

似乎这是git status输出。您可以将git add更改为stage area,然后使用git commit -m "your message"将此代码提交到本地存储库。

如果你想把你的工作回github.com,使用git push

这不是错误。 GitHub应用程序会在您使用时进行抓取,您通常可能没有这样做。因此,当您执行git status时,您现在可以看到远程主服务器实际上已经提前2次提交。只需按照相同的工作流程。或者在提交后使用GitHub应用程序的sync功能。

如果你要放弃改变你本地的master分支和远程(github上)拉主做到以下几点:

  1. 的git的复位 - 硬
  2. 混帐拉