Search code examples
gitgithubgithub-for-mac

Git error on GitHub for Mac asking me to use terminal to "git add"


While using GitHub for mac, I'm getting the following error box when I try to submit my commit:

# On branch Integrating-a-recommendations-textbox
# 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:   assets/app/scripts/templates/popups/recommend.hbs
#   modified:   web/wgwt/models.py
#   modified:   web/wgwt/views.py
#
no changes added to commit (use "git add" and/or "git commit -a")
 (1)

I looked at some other questions, for instance here: GitHub for Mac: Can't commit and sync or just commit because I have to add files before

But I don't want to use the terminal as a workaround, I want to commit using GitHub for mac. Restarting my machine didn't help. I can see the additions I made to the files in green in the GitHub for Mac changes tab, but can't seem to get past this error. Thanks for any help!


Solution

  • I understand that you want to use your GitHub for Mac GUI, but if you were to commit your changes through the terminal instead, here is what you would do:

    # Get the status of your working copy:
    $ git status
    # On branch Integrating-a-recommendations-textbox
    # 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:   assets/app/scripts/templates/popups/recommend.hbs
    #   modified:   web/wgwt/models.py
    #   modified:   web/wgwt/views.py
    #
    
    # Add each file you want to commit individually:
    $ git add web/wgwt/models.py
    
    # Or add them all at once:
    $ git add "*"
    
    # Make your commit
    $ git commit
    
    # You can also use the `--all` or `-a` flags during the commit
    # to add all **tracked/modified** files (but not untracked files)
    $ git commit -a
    
    # To push the new commits to a remote repo, use the following:
    $ git push <remote-name> head