zoukankan      html  css  js  c++  java
  • Git使用- 基本命令

    $ git config --global user.name "Your Name"   全局 name 设置

    $ git config --global user.email "email@example.com"  全局 email 设置

    $ pwd 查看当前路径

    $ git init 初始化仓库

    $ git add readme.txt 添加一个文件

    $ git add .  添加所有文件

    $ git commit -m "wrote a readme file" 提交改变至版本库

    $ ssh-keygen -t rsa -C "youremail@example.com"  创建秘钥

    $ git remote add origin git@github.com:michaelliao/learngit.git  将本地仓库与远程仓库关联

    $ git push origin <local_branch_name>:<remote_branch_name> 推送本地库至远程仓库

    $ git fetch -p 删除远程分支后,本地同步

    $ git checkout -b local-branchname origin/remote_branchname

    $git remote [-v] 查看当前配置有哪些远程仓库[别名实际链接地址]

    $git commit -m "备注" 提交并进行备注

    $git push -u origin A:B ,这样可以推到远程 B 分支上,同时设置为当前分支 A 的上游分支

    $git branch --set-upstream-to=origin/master master 关联本地分支与远程分支

    初始化一个代码库,并提交到远端

    git init

    git add .

    git commit -m "first commit"

    git remote rm origin

    git remote add origin git@github.com:baokang/Practice.git

    git push -u origin master

  • 相关阅读:
    51nod 1051【基础】
    HDU5971【瞎搞】
    Lightoj1018 【状压DP】
    HDU2604【矩阵快速幂】
    HDU1501【简单DP】
    HDU3555【数位DP】
    Lightoj1037【状压DP】
    51nod 1099【贪心】
    HDU5950【矩阵快速幂】
    51nod 1049【经典】
  • 原文地址:https://www.cnblogs.com/baokang/p/4982654.html
Copyright © 2011-2022 走看看