- 创建仓库
git init
- 显示所有分支
git branch -a
默认在master分支下 - pull分支下的内容,同步仓库;或者创建新的分支
1)pull代码:git pull origin a-remote-branch-name
如果pull出错,强制pull:git pull --allow-unrelated-histories origin a-remote-branch-name
2)创建新的分支:git branch new-branch-name
- 切换分支
git checkout branch-name
- 添加文件
git add filename.txt
添加所有文件
git add .
- commit文件
git commit add -m "本次提交的注释"
- 链接远程仓库
git remote add origin https://gitee.com/mybasename/aos15.git
- push到远程仓库
如果是pull下来的远程分支:git push origin a-remote-branch-name
;
如果是本地分支:git pull origin local-branch-name:remote-branch-name
,如果远程分支"remote-branch-name"不存在会自动创建;
git推送文件到远程仓库
最新推荐文章于 2023-05-02 21:04:32 发布