KJSCE-Codecell/Git-CheatSheet

Name: Git-CheatSheet

Owner: KJSCE Codecell

Description: null

Created: 2017-01-21 04:04:20.0

Updated: 2018-01-24 18:12:10.0

Pushed: 2017-10-12 18:04:57.0

Homepage: null

Size: 6

Language: null

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Git CheatSheet

Installation On Linux
ain Distro
 apt-get install git

dora Distro
-y install git
On windows and Mac

Download github desktop and shell from here

Getting Started
#to initialize git in a local directory
git init

#to clone a repo from github
git clone url
Configuring your name and email
#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"
Commiting files Check file status
git status
how to add files to the staging area
dd a specific file
t add filename

dd a specific file type
t add *.extention

dd all files 

t add .
 or 
t add *

his command will unstage the files which are not commited
t reset filename
How to commit Changes
 commit -m "Insert Commit message here"
See commit history
ailed commit history
log
Go back to a previous commit
reset --hard sha

sha is the alphanumeric you find when using git log

Branches
# 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
it checkout -b branchname   

 merge a branch to the current branch
it merge  branchname
Contributing to an Online Repo Workflow

Workflow

Remotes

Manage the set of repositories (“remotes”) whose branches you track.

#check available remotes
git remote 

#Add a new remote 
git remote add url
Pull and Push
#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    
Resources

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.