Create a GitHub repository
- Go to GitHub and press the button "start a project" which brings you to the "create a new repository" page.
- Select "Initialize this repository with a READ ME" to create a mark-down file with useful details for people viewing it.
Clone a repo locally
- Get the URL by clicking "clone or download" on GitHub
- Type: git clone [URL] (replace [url] with the url from GitHub)
- Type: git config --local user.name "Betty" (logs in the user to register the commits)
- Type: git config --local user.email "betty@betty-mail" (logs in the user to register the commits)
Display all remotes tied to this project
- Type: git remote (will display the default remote of this project)
- Type: git remote -v (will display full locations of all remotes on this project)
View how each branch syncs with the repo
- Type: alias graph="git log --all --decorate --oneline --graph" (this creates a reusable command alias called graph that saves the above options and makes it shorter to type)
- Type: graph (to view which repo the head and master branch are on)
- Type: git checkout origin/master (to checkout a remote tracking branch. It will put you in a detached head state. Usually you would want to stay in your local branch.)
Download and update a local project from a remote branch
- Type: git fetch origin (it reaches out to GitHub, find the new commit and brings it)
- Type: git status or graph (to see how many commits you are behind)
- Type: git merge origin/master (to catch yourself up with the last commit)
- Type: git pull (combines git fetch and git merge into a single command)