Many of the git commands used in the tutorial can be found below. As you follow
along the tutorial, feel free to copy-paste to make things easier. Stuff
enclosed in <BRACKETS>
, and in all caps should be replaced with user-specific
info.
This tutorial focuses on using the command line for git, but Graphical user interfaces (GUI) versions of git can be found here.
- Git local set-up (global config)
- Cloning the repo
- Stage changes
- Commit changes
- Push changes
- Make a new branch
See here for more info
$ git config --global user.name "<YOUR NAME>"
$ git config --global user.email <YOUR EMAIL>
The repo is hosted on github
$ git clone https://github.com/kescobo/KCLabgit.git
$ cd KCLabgit
$ git add <FILE_NAME>
$ git commit -m "<COMMIT MESSAGE>"
Alternatively, you can just do:
$ git commit
And your default shell text editor will open, allowing you to enter a commit
message. If your files are already version controlled, you can skip the "stage"
step, commiting all previously tracked files in one command using the -a
flag:
$ git commit -am "<COMMIT MESSAGE>"
If you cloned the repo, your "upstream" is already set. If you want to push to the same repo:
$ git push
If you want to push somewhere else, you can set a new upstream repo:
$ git remote add <REPO_NAME> <REPO_URL>
$ git push -u <REPO_NAME> <BRANCH_NAME>
$ git checkout -b <BRANCH_NAME>
# Make changes
$ git commit -am "<COMMIT MESSAGE>"
$ git push -u origin <BRANCH_NAME>