Skip to content

Instantly share code, notes, and snippets.

@dhruvdutt
Last active March 16, 2017 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dhruvdutt/2b91f37c91f3a3320db012246baaaef9 to your computer and use it in GitHub Desktop.
Save dhruvdutt/2b91f37c91f3a3320db012246baaaef9 to your computer and use it in GitHub Desktop.

Mandatory Commands

  1. git init: Initialize / create a new local repository. (Do this only once)
  2. git remote add origin [url without brackets]: Connect your local repo to an online repo. (Do this only once)
  3. git add .: Add all files to staging area.
  4. git commit -m "first commit": Commit changes with appropriate message.
  5. git push origin master: Send changes to the master branch of your remote repository.
  6. git pull origin master: Fetch and merge changes from the remote repo to your working repo.

Optional Commands

  1. git status: List the files you've changed and those you still need to add or commit.
  2. git log: Shows commit history.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment