Git

Quick Tips

Clone master branch only

git clone -b master --single-branch https://github.com/...
  • clone a specific branch
    git clone -b <branch_name> <remote_repo_name>
    

Contributing to a Project

List all of the branches

git branch -a

Create a branch on your local machine

git branch <name_branch>

Switch to the branch

git checkout <name_branch>

Create the branch on your local machine and switch in this branch

git checkout -b <name_branch>

Push the branch to remote repository

git push origin <name_branch>

check out the remote branch

git checkout -b <name_branch> origin/<name_branch>

roll back N comments

git reset --hard HEAD~$<N>
git push -f

Stop tracking and ignore changes

  • directory

    git rm -r --cached $DIR/
    
  • file

    git rm --cached $FILE
    

Tagging

  • list tags

    git tag
    
  • show tagger information

    git show $TagName
    
  • create annotated tag

    git tag -a v1.3 -m "version 1.3"
    
  • sync all tags to remote repository (sharing Tags)

    git push origin --tags
    
  • delete local tag

    git tag -d $TagName
    
  • delete remote tag

    git push --delete origin $TagName
    

results matching ""

    No results matching ""