Skip to content

ni3-kdm/git-checklist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

git-checklist [Need format Updates]

Main Repo (Upstream)

Fork Repo (Fork)

main <- fork


Fork:

  1. Clone Remote repo on local machine

git clone [repo url]

  1. Add remote repo url

git remote set-url origin [repo url]

  1. Add commit

git add . git add [filename] git commit -m "Message"

  1. Push branch and branch changes to remote

git push origin [branch_name]

  1. Update local branch/ take main branch changes

git pull origin [branch_name]

  1. Fetch particular branch locally (branch should be on remote)

git fetch [branch_name]

  1. Fetch all remote branches locally

git fetch --all

  1. Create new branch from updated local branch

git checkout -b [new branch name]

  1. Delete local branch (current branch should not be the same branch)

git branch -D [branch name]

  1. Cherry pick (copy br_A commit to br_B)

git cherry-pick [commit id]

  1. Merge remote/locally branch locally

git merge [branch name]

  1. Revert modified/tracked file (file exist on remote but made changes on local and have to revert changes)

git revert --stage [filename]

  1. Revert new/Untrack file (new file)

git clean -fd

  1. Resolve conflicts scenario

git commit (commit local changes) git pull (pull remote changes) resolve conflicts in local branch git add . (add resovled conflict files) git commit git push (push to remote branch)

  1. Update last commit A.

git add [file_name] / git add . git commit --amend git push -f origin [branch name]

16 Switch branch

git checkout [branch name]

  1. Set(restore) head to specific commit

git checkout [commit id]

  1. Commit history

git log

  1. Current branch status

git status

  1. List All visible branches

git branch

  1. List all(visible + hidden) local branches

git branch -a

  1. Current remote url

git remote -v

  1. Initialize current directory with git

git init

  1. Adding author name

global: git config --global user.name "Nitin Kadam" local: git config user.name "Nitin Kadam"

  1. Adding author email

global: git config --global user.email "[email protected]" local: git config user.email "[email protected]"

  1. Check file history

git blame [filename]

About

Checklist of popular git commands

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published