2021-06-14

将本地已创建的项目,上传至gitee

1.现在gitee创建一个仓库,并配置好邮箱和密码

2021-06-14

2.初始化本地仓库 将项目文件上传至本地的git仓库

$ git init
$ git add .
$ git commit -m 'xxxx'

3.将本地代码库与远程代码库相关联

$ git remote add origin https://gitee.com/httpxiaobocom/jdPage.git

4.强制把远程仓库的代码跟新到当前分支上面。ps:如果仓库为空这一步可以跳过

$ git pull --rebase origin master

5.强制合并可能会出现问题

remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 7 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (7/7), 12.64 KiB | 446.00 KiB/s, done.
From https://gitee.com/httpxiaobocom/jdPage
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
error: could not apply 59c7893... 完成登录注册,并用axios拦截请求
Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort"

6.但是提示已经指出了怎么解决问题了

"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort"

这里就执行git add . 然后继续合并就行了
git add .
git rebase --continue

7最后一步就直接进行远程提交就好了

$ git push origin master


Enumerating objects: 32, done.
Counting objects: 100% (32/32), done.
Delta compression using up to 8 threads
Compressing objects: 100% (28/28), done.
Writing objects: 100% (30/30), 91.39 KiB | 2.95 MiB/s, done.
Total 30 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-5.0]
To https://gitee.com/httpxiaobocom/jdPage.git
   98e1526..2c68f07  master -> master
上一篇:git commit 合并


下一篇:git merge and git rebase