Skip to content

Instantly share code, notes, and snippets.

@theeasiestway
Last active October 24, 2019 07:23
Show Gist options
  • Save theeasiestway/20e0b961f11d56e6a3e0dbbf32f5678b to your computer and use it in GitHub Desktop.
Save theeasiestway/20e0b961f11d56e6a3e0dbbf32f5678b to your computer and use it in GitHub Desktop.
The most important commands for Git
# Set a new remote
$ git remote add origin https://github.com/user/repo.git
# Update a remote url
$ git remote set-url origin https://github.com/user/repo.git
# Verify new remote
$ git remote -v
> origin https://github.com/user/repo.git (fetch)
> origin https://github.com/user/repo.git (push)
# Set up to track remote branch (Or if error "No tracked branch configured for branch develop or the branch doesn't exist." was occured)
$ git checkout develop
$ git branch --set-upstream-to=origin/develop
> Branch 'develop' set up to track remote branch 'develop' from 'origin'.
#In case of an error: "fatal: refusing to merge unrelated histories" while git pull
$ git pull origin master --allow-unrelated-histories
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment