Git Command Summary

  • git init initialise a repository
  • git add add a file to the staging area
  • git commit commit changes to the repository
    • -a automatically stage existing files
    • -m add commit message directly
  • git log show changes in commits
  • git diff compare repository with last commit
  • git mv rename files in filesystem and repository
  • git rm remove files in filesystem and repository
    • --cached remove files from repository but not filesystem
  • git checkout <sha> checkout a previous commit referenced by the specified SHA-1 checksum
  • git clean delete untracked files from your repository
    • -n do a dry-run without actually deleting
  • git revert <sha> undo changes to a commit history by creating a new commit, which is the inverse of <sha>
  • git reset Undo changes to your repository depending on the options chosen
    • --soft <sha> undo commit history back to the specified SHA-1 checksum
    • --mixed <sha> undo commit history and staging index back to the specified SHA-1 checksum
    • --hard <sha> undo commit history, staging index and file system back to the specified SHA-1 checksum
  • git clone clone a remote repository
  • git checkout checkout a new branch
    • git checkout -b create and checkout a new branch
  • git push push your committed changes to the remote repository
    • -u origin set the remote repository branch you want to commit to
  • git pull download changes from remote repository

results matching ""

    No results matching ""