Skip to content

ohm-vishwa/Git-Github-Commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Git & Github Commands

Quick Refrence of git & github commands

see configuration

git config --list

set user name

git config --global user.name "ohm_vishwa"

set email

git config --global user.email "example@email.com"

Basic Commands

initialize git

git init

clone github repo

git clone <url>

view files

ls

view hidden files

ls -la

check status

git status

staging single file

git add <file name>

staging all files

git add .

commit on git

git commit -m "message"

add & commit togther

git commit -am "message"

push code on github repo (Once)

git push -u origin main

after -u origin main

git push

verify remote

git remote -v

add remote repo

git remote add origin <url>

set new url

git remote set-url origin <url> 

check branch

git branch

rename branch

git branch -M main

navigate

git checkout <branch_name>

create new branch

git checkout -b <new_branch_name> 

delete branch

git branch -d <branch_name>

push other branch

git push --set-upstream origin <branch_name>

compare commits, branches, files & more

git diff <branch_name>

merge 2 branches or create pull request

git merge <branch_name>

feth & dawnload content from a remote repo local repo

git pull origin main

view all commit

git log

remove staged changes

git reset <file_name>

or,

git reset

restore commited changes (for one commit)

git reset HEAD~1

restore commited changes (for many commits) using git log

git reset <commit_hash>

or,

git commit --hard <commit_hash> 

Token Authorization

git remote set-url origin https://<token>@github.com/<user_name>/<repo_name>

About

Quick Refrence of git & github commands

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published