Skip to content

Instantly share code, notes, and snippets.

@darxtrix
Last active August 29, 2015 14:01
Show Gist options
  • Save darxtrix/d319e019ac63f392fed6 to your computer and use it in GitHub Desktop.
Save darxtrix/d319e019ac63f392fed6 to your computer and use it in GitHub Desktop.
Some basic git commands list and their working.
# Git Commands and their working
# remotes are the copy of your local files at somewhere else on the we
# git listing all the remotes of a repo in a verbose mode
git remote -v
# adding a new remote
git remote add <remote-name> <repo-url>
# git remove a remote branch
git remote remove <remote-name>
# default remote is origin
# git pulling
git pull <remote-name> <branch-name>
# git pushing
git push <remote-name> <branch-name>
# git clone
git clone <clone-url>
# checking out the remotes in a less verbose mode
git remote
# git merging branch 1 into branch 2 without commiting any changes made in the branch-2 , i.e @ fast-forward mode
git checkout <branch-1>
git merge <branch-1> -ff
# checking out which branch you are at
git branch
# switching to a new branch by saving changes in the current branch
git checkout -b <new-branch-name>
# git changing to other branch
git checkout <other-branch>
# stashing changes while switching to other branch
git stash
# changing the global git config file like for using git over proxy
git --global --config http::proxy http://user:pass@<proxy>:<port>/
# removing uncommited changes
git checkout --
# checking history
git log
# checking status
git status
# git deleting a branch
git branch -D <branch-name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment