0

Using the GitHub application on Mac (not the cli), I have this error which I don't really understand and don't know how to fix. I know its an error because the application throws up a window that says "GitHub Error". I need to commit the changes to the files listed below, but GitHub won't let me. When I press the Commit button, the error appears and it seems I can't do anything to fix it. Any help would be great.

# 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)
MFB
  • 19,017
  • 27
  • 72
  • 118
  • Why do you think its an error? Its `git status`! and probably also appears after a successful commit – Ozair Kafray Jul 27 '12 at 11:49
  • Please add to this question how you are writing the `git commit` command as well. – Ozair Kafray Jul 27 '12 at 11:54
  • Is that an error? It seems like just information. `Your branch is ahead of 'origin/master' by 2 commits` means you have two commits in your local branch, which are not yet pushed to remote branch. Please tell us when are you getting error, which is the git command used and what is the error message? – Karthik Bose Jul 27 '12 at 11:56
  • I have added clarity to the question – MFB Jul 27 '12 at 20:42

3 Answers3

4

By this message, git tells you that your local commit tree is ahead of repo in github.com.


Repo in github               Your local


                                 Y    <-+
                                 |      |  ahead of 2 commits
                                 Z    <-+
                                 |
commit  A    <---------------->  A
        | \                      | \  
        B  D                     B  D
        | /                      | /
        C                        C
        |                        |

Seems this is output of git status. You can just git add your changes to stage area, and then use git commit -m "your message" to commit this code to your local repository.

If you want to put your work back to github.com, use git push.

KingCrunch
  • 128,817
  • 21
  • 151
  • 173
xiaowl
  • 5,177
  • 3
  • 27
  • 28
0

It is not an error. GitHub app does a fetch when you use, which you normally might not have done. Hence when you do git status, you now see that the remote master actually has moved ahead by 2 commits. Just follow you same workflow. Or use the sync feature of the GitHub app after committing.

manojlds
  • 290,304
  • 63
  • 469
  • 417
0

If you want to discard changes to your local master branch and pull master from remote (github) do the following:

  1. git reset --hard
  2. git pull
RC_02
  • 3,146
  • 1
  • 18
  • 20