git相关

来源:互联网 发布:redis做数据库 编辑:程序博客网 时间:2024/06/05 06:44

git常用命令:

1.git init

2.git add [filename]

3.git commit -m "[comment]"

4.git checkout -- [filename]

5.git reset HEAD [filename]

6.git reset --hard HEAD^ 

   git reset --hard HEAD^^

   git reset --hard HEAD~100

   git reset --hard [commit-id]

7.git status

8.git log

   git log --pretty=oneline

   git log --graph --pretty=oneline

9.git reflog

10.git checkout -b [sub-branch-name]

     git checkout [branch-name]

11.git stash

     git stash list

     git stash pop

12.git merge [branch-name]

      git merge --no-ff -m "[comment]" [branch-name]

13.git branch -d [branch-name]

14.git remote add [remote-name] [remote-address]

15.git push -u [remote-name] [branch-name]

      git push [remote-name] [branch-name]

16.git clone [remote-address]

17.git tag [tag-name]

      git tag [tag-name] [commit-id]

      git tag -a [tag-name] -m "[comment]"

18.git show [tag-name]

      git tag

19.git tag -d [tag-name]

      git push [remote-name] :refs/tags/[tag-name]

20.git push [remote-name] [tag-name]

      git push [remote-name] --tags

21.git pull 

22.git remote 

      git remote -v

23.git checkout -b [branch-name] [remote-name]/[branch-name]

24.git diff [filename] -- 若添加到了暂存库则查看的是和暂存库文件中的区别,若还没有放到暂存库,查看的是和版本库最新版本文件区别。

参考网址:https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000