Skip to content
Neil Moore edited this page Feb 18, 2015 · 1 revision

GitHub Usage

This page will list and walk you through some common operations with Git while working on this project. Operations will be:

  • Pulling down changes and how to integrate/remove local changes
  • Resolving merge conflicts
  • Pushing to a specific branch.

Git pull

To pull changes that are in the remote repository, use the command git pull which should automatically pull down all the changes and merge those aren't conflicting with your code.

If the git pull cancels with a message similar to "Merge would override local changes made to file , ABORT", then you have to either integrate this local change with the pulled code or discard the local changes and accept the remote changes.

Discarding local changes

This step assumes that the changes have not been committed but are just modified.

To discard uncommitted or staged (via git add or git commit -a) changes, run the following set of commands:

  1. git stash
  2. git stash drop

This reverts your local code to the latest commit, allowing git pull to succeed.

To discard all staged changes (those not committed but show up green when git status is run), run this command: git reset HEAD -- . That command recursively unstages all staged files in the project.

To discard a commit that hasn't been pushed ( via git push origin <branch>) run this command: git reset --soft HEAD^

To integrate local changes into remote changes

Run the follow commands in order:

  1. git stash save <Save message>
  2. git pull
  3. git stash pop

After that last command, it's quite likely that you'll get a message about merge conflicts. I'll go over these in a later section.

Resolving Merge Conflicts

Clone this wiki locally