Git branch is ahead of origin/master


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)


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.


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.


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

<ol><li>git reset --hard</li> <li>git pull</li> </ol>


  • Is there a C function to find the second occurrence of substring in string?
  • Undefined Offet Error in cURL Code
  • Git Hub GitIgnore error
  • How to get Environment Variable from Shell in PHP/phpinfo()
  • count the occurrences of all the letters in a string PHP
  • function to check array strpos and return an array
  • Laravel env file is not loading
  • Whitelist a set of properties from a multidimensional json array and delete the rest
  • Why does checkout sometimes stage a file?
  • How to get Confirmation of email send or discarded in android
  • Dom Node for PHP find href attribute issue
  • cannot load gems in test environment
  • Disable add to cart redirection
  • c# web browser click on a button with a class name
  • Is it possible to ask GIT, don't show a file?
  • php show all images in directory and sort by last modified
  • EF 4.1 DBContext AutoDetectChangesEnabled
  • Android changing fragment order inside FragmentPagerAdapter
  • Web.config system.webserver errors
  • Checking free space on FTP server
  • Change Inet root folder for iis 7
  • Finding past revisions of files in StarTeam w/ .NET SDK / C#
  • Updated Ionic CLI but shows previous version (Windows)
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • VB.net deserialize, JSON Conversion from type 'Dictionary(Of String,Object)' to type '
  • Matrix multiplication with MKL
  • Load html files in TinyMce
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Hits per day in Google Big Query
  • coudnt use logback because of log4j
  • File not found error Google Drive API
  • How to get Windows thread pool to call class member function?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Converting MP3 duration time
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal