Friday, March 27, 2020

Handy Command for GitHub

i just organized a list of GitHub command, i hope this will help you speed up the GitHub adaption


-git init : create repository
-git status: Compare working directory, staging area and current branch
-git add: add changes to staging area
-git commit: Commit changes from staging to current branch
-git log: show history of project commits
-git branch -c : Create a new branch1
-git checkout: check out switch to a branch
-git branch: List branches
-git checkout: check out a branch (update HEAD)
-git checkout -b: Create branch, then check it out
-git stash: Stash changes from working directory
-git stash list: List stashes
-git stash pop: apply stashed changes to working directory.
-git branch -v: list latest version of changes in each branch
-git branch -d: delete a branch
-git -am: git add commit within one line
-git merge: Merge changes from different branches


- git log: Show history of project commit
- git log <ref>: show history of pro commit prior to <ref>
- git log -all: show all commits
- git log --author <string> : show commits with matching author
- git log --since <date>: show commits since date
- git log --until <date>: show commits prior to date
- git show: show a single commit
- git diff: show the difference between commits, working directory and the staging area.
- git diff <commit> show diff between working direct and commit.
- git diff <commitA>..<commitB>: Diff between commit
- git diff <refA>..<refB>: Diff between ref(branches, et, al.)
- git log --oneline: show one commit per line
- git log --graph: show graph view of commits
- git show <commit>: show difference introduced by commit

- git diff --cached: Diff between staging area and HEAD

- git remote add : Add a new at
- git remote -v: List remote repositories
- git push -u : Push to , and set default upstream for
- git fetch: Fetch changes from remote repository
- git pull: Fetch, and then merge



git merge: merge changes from different branches
git merge --abort: abort an in process merge
git log branch1..branch2: log of commit in branch2 but not in branch1
git log branch1...branch2: log of commit in either branch but not both.
git merge --no-commit no-off: attempt to merge, but od not create an auto merge or ff merge
git branch --no-merged branch1: List branches that have unmerged commits
git branch --merged branch1: list branches that have no unmerged commits

No comments:

Post a Comment