Skip to content

Instantly share code, notes, and snippets.

@tterrag1098
Last active September 14, 2016 16:32
Show Gist options
  • Save tterrag1098/56abeead0268b0ae3ae24dab00440652 to your computer and use it in GitHub Desktop.
Save tterrag1098/56abeead0268b0ae3ae24dab00440652 to your computer and use it in GitHub Desktop.

Command Descriptions

Command Info
git clone [repo] Use the URL from the github page, this copies the repo to your computer
git status Prints out the current branch and other info
git checkout [branch] Switches to a different branch. Use -b to create a new branch.
git add [file] <file2> ... Adds files to be staged (used) for the next commit. Use git add . to add all changed files.
git commit Creates a commit with the staged changes, pops up a vi window to add a message. A shortcut is to do git commit -m "Commit message here" and it will directly commit with the given message.
git push Pushes all new commits to the remote. For new branches, use git push -u origin [branch].

Setup Steps

To set up the repository, the basic steps are:

  1. git checkout https://github.com/TeamRocket-COSC425/MathCSClubWebsite.git run in any directory
  2. cd MathCSClubWebsite to enter into the repo folder
  3. git checkout -b [branch name] to create a new branch to work on
  4. Make changes.
  5. git add . to add all changed files to be staged.
  6. git commit to commit your changes.
  7. git push -u origin [branch name] to push your changes to the remote repo. -u origin [branch name] can be omitted if this is not your first push.
  8. Profit.

To update your existing repository:

  1. git checkout master To switch over to the master branch.
  2. git pull and git fetch to update the repo locally.
  3. Continue working.

Shortcuts

One other shortcut is to use git commit -a which will add all changed files and commit. So you can skip the git add . step.

For any command, you can always run git [command] --help which will open up a man page for that command. Also see https://git-scm.com/doc.

Graphical Git Clients

Once you are comfortable with the command line (or not) feel free to use a graphical Git client, like the one that comes with the git installation, git-gui (just run git gui from any command prompt), or 3rd party apps like Github Desktop and GitKraken. I have some experience with both so I can possibly help out, but I am most familiar with command line :D.

Other

Any more questions just ask in #coding-help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment