github常用命令

  1. 下载git客户端地址: https://git-for-windows.github.io/
  2. 在本地新建一个分支: git branch Branch1
    切换到你的新分支: git checkout Branch1
    将新分支发布在github上: git push origin Branch1
    在本地删除一个分支: git branch -d Branch1(没用过)
    在github远程端删除一个分支: git push origin :Branch1 (分支名前的冒号代表删除)

  3. 直接使用git pull和git push的设置
    Git branch –set-upstream-to=origin/master master
    git branch –set-upstream-to=origin/ThirdParty ThirdParty
    git config –global push.default matching

  4. 完整的流程:clone(分支代码)– 切换–检查状态—添加—-提交—– push
bayu@BAYU1 MINGW64 /c/baiyu
$ git clone -b Usage-Report https://github.hpe.com/CAS/hubot.git
Cloning into 'hubot'...
remote: Counting objects: 1042, done.
remote: Compressing objects: 100% (31/31), done.
Receiving objects: 100% (1042/1042), 205.11 KiB | 0 bytes/s, done.
remote: Total 1042 (delta 17), reused 0 (delta 0), pack-reused 1011
Resolving deltas: 100% (679/679), done.
Checking connectivity... done.

bayu@BAYU1 MINGW64 /c/baiyu
$ cd hubot

bayu@BAYU1 MINGW64 /c/baiyu/hubot (Usage-Report)
$ git checkout master
Branch master set up to track remote branch master from origin.
Switched to a new branch 'master'

bayu@BAYU1 MINGW64 /c/baiyu/hubot (master)
$ ll
total 21
-rwxr-xr-x 1 bayu 1049089 2035 Jan 13 14:09 bot.sh*
-rw-r--r-- 1 bayu 1049089 1289 Jan 13 14:09 docker-compose-dev.yml
-rw-r--r-- 1 bayu 1049089  588 Jan 13 14:09 docker-compose-pro.yml
-rw-r--r-- 1 bayu 1049089  539 Jan 13 14:09 docker-compose-test.yml
drwxr-xr-x 1 bayu 1049089    0 Jan 13 14:11 hubot/
drwxr-xr-x 1 bayu 1049089    0 Jan 13 14:09 nginx/
-rw-r--r-- 1 bayu 1049089 2637 Jan 13 14:09 README.md

bayu@BAYU1 MINGW64 /c/baiyu/hubot (master)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean

bayu@BAYU1 MINGW64 /c/baiyu/hubot (master)
$ git checkout Usage-Report
Switched to branch 'Usage-Report'
Your branch is up-to-date with 'origin/Usage-Report'.


bayu@BAYU1 MINGW64 /c/baiyu/hubot (Usage-Report)
$ git status
On branch Usage-Report
Your branch is up-to-date with 'origin/Usage-Report'.
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   hubot/Dockerfile
        modified:   hubot/environment.sh
        deleted:    hubot/files/addressServiceUsageReport.sh
        deleted:    hubot/files/fezServiceUsageReport.sh
        deleted:    hubot/scripts/addressServiceUsageReport.coffee
        modified:   hubot/scripts/credentials.coffee
        deleted:    hubot/scripts/fezServiceUsageReport.coffee

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        hubot/files/nexus-onboard.sh
        hubot/scripts/nexus_onboard.coffee
        hubot/scripts/restart_controller.coffee

no changes added to commit (use "git add" and/or "git commit -a")


bayu@BAYU1 MINGW64 /c/baiyu/hubot (Usage-Report)
$ git add .

bayu@BAYU1 MINGW64 /c/baiyu/hubot (Usage-Report)
$ git commit -m 'the master code update,pull the master code,then push to github                                                                                                                                                  my branch Usage-Report'
[Usage-Report 8cdc686] the master code update,pull the master code,then push to                                                                                                                                                  github my branch Usage-Report
 5 files changed, 328 insertions(+), 2 deletions(-)
 create mode 100644 hubot/files/nexus-onboard.sh
 create mode 100644 hubot/scripts/nexus_onboard.coffee
 create mode 100644 hubot/scripts/restart_controller.coffee

bayu@BAYU1 MINGW64 /c/baiyu/hubot (Usage-Report)
$ git push origin Usage-Report
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (10/10), 4.15 KiB | 0 bytes/s, done.
Total 10 (delta 6), reused 2 (delta 2)
remote: Resolving deltas: 100% (6/6), completed with 6 local objects.
To https://github.hpe.com/CAS/hubot.git
   223ed71..8cdc686  Usage-Report -> Usage-Report
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值