Skip to content

Instantly share code, notes, and snippets.

@mojtabaahn
Created July 29, 2019 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mojtabaahn/41664fbd4f0a54068c44096681f7f688 to your computer and use it in GitHub Desktop.
Save mojtabaahn/41664fbd4f0a54068c44096681f7f688 to your computer and use it in GitHub Desktop.

git-docs

Hi, This is going to be my personal git documentation.

git clone <giturl> clones git from url

git remote add origin <giturl> adds remote origin to git

git pull origin master --allow-unrelated-histories pull from origin

git add [-A/filenames] adds files to stage

git commit -m "<message>" commits with message

git push master origin pushes the commits to origin

git branch shows current branch

git branch <branchname> creates new branch

git branch -d <branchname> deletes a branch

git checkout <branchname/tagID> checkouts to branch

git log [--pretty=oneline] logs for the current branch

git merge origin <branchname> merges from a branch

git rm [--cached] [-r] <filename> removes file from both git and filesystem. if --cached is set, only removes from git. -r is for directories (recursively)

git show <commitID/tagID> show commit info and differences

git tag -a <tagname> [<commitID>] -m '<message>' tag current status

git tag show tags

git push origin <tagID> git push origin --tags pushes tags

git help <command> shows manual for command

git blame <filename> [-L<linenumber>] check report for file and line number

git bisect start start binary search commits

git bisect <good/bad> good or bad status check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment