Skip to content

Instantly share code, notes, and snippets.

@acontreras89
Created April 11, 2017 13:45
Show Gist options
  • Save acontreras89/9256c94bb0895b975086bec5c1be35e9 to your computer and use it in GitHub Desktop.
Save acontreras89/9256c94bb0895b975086bec5c1be35e9 to your computer and use it in GitHub Desktop.
Git tips and tricks

Git tips and tricks

If the branch we are working on has been updated before we push our work

We will get an error like this:

[rejected] master -> master (non-fast forward)
error: failed to push some refs to '[email protected]:me/me.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'non-fast forward'
section of 'git push --help' for details.

If we simply use git pull to update the branch, a merge commit will be created. To avoid this, pass the --rebase flag to git pull

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment