Skip to content

Instantly share code, notes, and snippets.

@nihal-singh
Created August 31, 2018 17:26
Show Gist options
  • Save nihal-singh/7076873abc79419cfea88eb330b8ec7f to your computer and use it in GitHub Desktop.
Save nihal-singh/7076873abc79419cfea88eb330b8ec7f to your computer and use it in GitHub Desktop.
Github
Setting a remote repository on github
-----------------------------------------
* git remote - view current remotes
* git remote add origin https_repo_url - we can give any name instead of origin,it is the name in repo to refer to repo on github.
* git remote -v - To verify that the repo url was added correctly [v-verbose,provides more info]
* git push origin master - git push is used to push the local repo to github(remote)
[it takes two arguments - the remote I want to send changes to and name of local branch to push.]
* git pull origin master - git pull is used to pull the changes of the remote repo to the local directory.
* git fetch - fetches the remote commit of the branch to the local copy of the repository .we can then compare the commit made to the
local repo with the commit made remotely.
*****************************************************************
so git pull origin master = git fetch origin +
git merge master origin/master
******************************************************************
* pull request - it is a request(by other user) to merge the contents of their branch into the master.
**if we want to make other's push to our repository,then add them to the collaborators section in github.
#########################################################
when we clone a repository a remote gets setup automatically.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment