GitHub使用-初始化及第一次不同历史版本合并提交处理方法

记录一次GitHub托管托管文件相关步骤和指令


kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb
$ git init
Initialized empty Git repository in D:/2.Work/Ww-Jsfzb/.git/

kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ ll
total 4
drwxr-xr-x 1 kylin 197121 0 9月  22 10:28 LocalFiles/
drwxr-xr-x 1 kylin 197121 0 9月  22 10:01 WorkFiles/

kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ ls -a
./  ../  .git/  LocalFiles/  WorkFiles/

kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ git remote add origin https://github.com/Qichen-Kylin/WwW-Jsfzb.git

kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ git pull
remote: Repository not found.
fatal: repository 'https://github.com/Qichen-Kylin/WwW-Jsfzb.git/' not found
#这里在自己的GitHub上建立WwW-Jsfzb远程仓库
kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ git pull
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.
From https://github.com/Qichen-Kylin/WwW-Jsfzb
 * [new branch]      master     -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master


kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ ll -a
total 12
drwxr-xr-x 1 kylin 197121 0 9月  22 10:32 ./
drwxr-xr-x 1 kylin 197121 0 9月  22 10:26 ../
drwxr-xr-x 1 kylin 197121 0 9月  22 10:38 .git/
drwxr-xr-x 1 kylin 197121 0 9月  22 10:28 LocalFiles/
drwxr-xr-x 1 kylin 197121 0 9月  22 10:01 WorkFiles/


kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ git add .

kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   .gitignore
        new file:   "WorkFiles/Cloudera Enterprise 6.x\345\217\221\350\241\214\350\257\264\346\230\216_\347\241\254\344\273\266\350\246\201\346\261\202&\351\233\206\347\276\244\344\270\273\346\234\272\350\247\222\350\211\262\345\210\206\351\205\215.xlsx"
        new file:   "WorkFiles/\345\244\247\346\225\260\346\215\256\351\233\206\347\276\244\347\241\254\344\273\266\344\272\247\345\223\201\351\205\215\347\275\256\346\270\205\345\215\225-CDH\351\203\250\347\275\262\346\220\255\345\273\272_V1.0.0.xlsx"


kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ git commit -m "20200922 First Commit"
[master (root-commit) 86c0f1f] 20200922 First Commit
 3 files changed, 24 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 "WorkFiles/Cloudera Enterprise 6.x\345\217\221\350\241\214\350\257\264\346\230\216_\347\241\254\344\273\266\350\246\201\346\261\202&\351\233\206\347\276\244\344\270\273\346\234\272\350\247\222\350\211\262\345\210\206\351\205\215.xlsx"
 create mode 100644 "WorkFiles/\345\244\247\346\225\260\346\215\256\351\233\206\347\276\244\347\241\254\344\273\266\344\272\247\345\223\201\351\205\215\347\275\256\346\270\205\345\215\225-CDH\351\203\250\347\275\262\346\220\255\345\273\272_V1.0.0.xlsx"

kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ git push -u origin master
To https://github.com/Qichen-Kylin/WwW-Jsfzb.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/Qichen-Kylin/WwW-Jsfzb.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master


kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ git pull origin master
From https://github.com/Qichen-Kylin/WwW-Jsfzb
 * branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories

kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ git push -u origin master
To https://github.com/Qichen-Kylin/WwW-Jsfzb.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/Qichen-Kylin/WwW-Jsfzb.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ git status
On branch master
nothing to commit, working tree clean

kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ ll -a
total 13
drwxr-xr-x 1 kylin 197121   0 9月  22 10:40 ./
drwxr-xr-x 1 kylin 197121   0 9月  22 10:26 ../
drwxr-xr-x 1 kylin 197121   0 9月  22 10:48 .git/
-rw-r--r-- 1 kylin 197121 414 9月  22 10:41 .gitignore
drwxr-xr-x 1 kylin 197121   0 9月  22 10:28 LocalFiles/
drwxr-xr-x 1 kylin 197121   0 9月  22 10:01 WorkFiles/

kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ git pull https://github.com/Qichen-Kylin/WwW-Jsfzb.git master
From https://github.com/Qichen-Kylin/WwW-Jsfzb
 * branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories
#出现不相关历史,解决办法:加一句--allow-unrelated-histories 允许不相关历史强制合并
kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ git pull origin master --allow-unrelated-histories
From https://github.com/Qichen-Kylin/WwW-Jsfzb
 * branch            master     -> FETCH_HEAD
Merge made by the 'recursive' strategy.
 LICENSE   | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 README.md |   2 +
 2 files changed, 203 insertions(+)
 create mode 100644 LICENSE
 create mode 100644 README.md

kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ git status
On branch master
nothing to commit, working tree clean

kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$ git push -u origin master
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 8 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 46.54 KiB | 1.94 MiB/s, done.
Total 8 (delta 0), reused 0 (delta 0)
To https://github.com/Qichen-Kylin/WwW-Jsfzb.git
   3e8de1b..2f9a65d  master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

kylin@kylin MINGW64 /d/2.Work/Ww-Jsfzb (master)
$

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值