Skip to content

Instantly share code, notes, and snippets.

@theankitgaurav
Last active April 5, 2017 03:29
Show Gist options
  • Save theankitgaurav/2fc1f0103bf561cd24d662b9d2e30f7a to your computer and use it in GitHub Desktop.
Save theankitgaurav/2fc1f0103bf561cd24d662b9d2e30f7a to your computer and use it in GitHub Desktop.

Start a local repo and push to push to remote

git init

git add .

git commit -m "Add intial files"

git remote add origin REPO_URL

git push

List all remotes

git remote -v

Download changes from remote without integrating into HEAD

git fetch

Download changes from remote and integrate into HEAD

git pull

Discard all local changes

git reset --hard HEAD

Discard local changes in a specfied file

git reset --hard

Allow for uncommiting something, keeping the changes, any number of times

The number after HEAD indicates the number of commit we want to undo git reset --soft HEAD~3

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