The Push and Pull System
Through GitHub
Once you have linked your local repository and remote repository together, you can add a README. This is also the time you can add a license and .gitignore file. This can all be done through GitHub, and does not have to happen on your machine.
Pulling from GitHub
You can pull from GitHub using the command git pull
. But, to make it more specific, you can use git pull origin [branch name]
. If you only have a master branch, using just git pull
is enough.
You have to track a branch if you want the pull to work. This is where you can use git pull origin master
.
Pushing to GitHub
When you make changes locally, you have to use the command git push
to make the changes show up on the remote branch. You can use a couple of different flags with this command. If you want to push to the origin, you can use git push -u origin master
. Every time you do this, the terminal will ask you for your GitHub username and password, which is a safety measure.
Deleting Remote Branches
When you have merged a branch with master, you have to push that change to origin, otherwise it will not appear on GitHub. Once you have done that, it is pushed and merged, and you will probably not need that branch anymore. You can delete the branch by using git push origin --delete [branch name]
.