zoukankan      html  css  js  c++  java
  • Git 一些常用命令

    首先是基本的:

     1 git add *
     2 
     3 git commit -a -m "commit message"  
     4 
     5 //本地提交
     6 
     7 git remote add origin username@serverip:projectName
     8 
     9 git push origin master
    10 
    11 git fetch git pull
    然后是:
    1 git reset HEAD^ //只回退commit 与 index信息
    2 //如果在服务器端的操作,想回退的话,可以用--f
    3 git push --f origin master //这样,服务器的版本会被强制覆盖
    4 git reset --hard // 代码级回退,所有东西都被回退
    5 git rebase -i HEAD~5 //再将除第一条pick外全部改为squash,表示将最后的5次提交合并为一次提交
    下面是Git打差异包的命令:
    [shell]
    1 git archive HEAD -o diff.zip $(git diff HEAD $hash --name-only)
    2 OR
    3 git archive HEAD -o diff.zip $(git diff $hash1 $hash2 --name-only)
    4 #有时候会出现重命名过度的问题,用这条命令解决 git config --global diff.renamelimit "0"
  • 相关阅读:
    Tree Grafting
    敌兵布阵
    畅通工程(并查集)
    The Suspects(并查集)
    Ubiquitous Religions(friends变形)
    Friends(采用树结构的非线性表编程)
    小球下落(二叉树)
    铁轨
    卡片游戏
    征服C指针
  • 原文地址:https://www.cnblogs.com/trying/p/2863824.html
Copyright © 2011-2022 走看看