美文网首页
Git Commands

Git Commands

作者: sabrinachen321 | 来源:发表于2018-06-11 10:53 被阅读0次

    Clone

    1. git clone <repo-address>

    2. Check the remote repository name: git remote -v

    3. Change the remote address: git remote set-url origin [url]

    Branch

    1. Get all remote branches information: git fetch

    2. Pull the current remote branch to local: git pull

    3. git checkout <branch-name>

    4. Start a new branch: git checkout -b <new-branch-name>

    5. Push the new local branch to remote: git push origin <new-branch-name>

    6. Delete the branch from remote: git push origin --delete <new-branch-name>

    Submodule

    1. git submodule update --init --recursive

    2. Update the submodule

        a. Do “git diff” in the upper directory to get the submodule CLN, then use "git checkout <CLN>" to checkout the CLN in submodule's directory

        c. git submodule update

    Tag

    Tag is a reference to some commit. We can also checkout a branch via its commit number.

    1. List all the version tags: git tag

    2. See the current tag: git describe

    Rebase

    https://blog.csdn.net/wh_19910525/article/details/7554489

    https://github.com/geeeeeeeeek/git-recipes/wiki/5.1-%E4%BB%A3%E7%A0%81%E5%90%88%E5%B9%B6%EF%BC%9AMerge%E3%80%81Rebase-%E7%9A%84%E9%80%89%E6%8B%A9

    Commit

    1. git add -A

    2. git commit –m “commit description”

    3. git log

    4. git push

    5. delete untracked files

        a. files: git clean -f

        b. files and directories: git clean -fd

        c. check what will be deleted first: git clean -n

    相关文章

      网友评论

          本文标题:Git Commands

          本文链接:https://www.haomeiwen.com/subject/gzpceftx.html