# Debain Distro
sudo apt-get install git
# Fedora Distro
yum -y install git
Download github desktop and shell
from here
# to initialize git in a local directory
git init
# to clone a repo from github
git clone url
# set up user name
git config --global user.name "Insert your name here"
# set up user email
git config --global user.email "Insert your email here"
git status
how to add files to the staging area
# add a specific file
git add filename
# add a specific file type
git add *.extention
# add all files
git add .
or
git add *
# this command will unstage the files which are not commited
git reset filename
git commit -m "Insert Commit message here"
# detailed commit history
git log
git reset --hard sha
sha is the alphanumeric. You find sha hash using git log
# check current branch names
git branch
# add a new branch
git branch branchname
# switch to a different branch
git checkout branch name
# add a new branch and switch to that branch
git checkout -b branchname
# merge a branch to the current branch
git merge branchname
Manage the set of repositories ("remotes") whose branches you track.
# check available remotes
git remote
# Add a new remote
git remote add url
# pull all the branches from your main repo
git pull
# pull specific branch from a specific repo
git pull remote-name branch-name
# push all the branches to the main repo
git push
# push specific branch to a specific repo
git push remote-name branch-name
- Learn by doing
- Try Github
- learnGitBranching
- Pro Git - Free Book
- Learn more about Markdown format
- Learn more about github gist
- See your contributions here