git系列文章
add
到暂存区,commit
到仓库之后,不想push了???git reset --soft HEAD^
Enumerating objects: 16248, done.
Counting objects: 100% (16248/16248), done.
Delta compression using up to 12 threads
Compressing objects: 100% (10573/10573), done.
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
send-pack: unexpected disconnect while reading sideband packet
Writing objects: 100% (16248/16248), 6.33 GiB | 10.84 MiB/s, done.
Total 16248 (delta 5237), reused 16245 (delta 5237), pack-reused 0
fatal: the remote end hung up unexpectedly
Everything up-to-date

git rm --cached filename
git commit -m "delete remote file filename "
git push -u origin master(此处是当前分支的名字)
# 在桌面创建test目录mkdir /Users/wangsaichao/Desktop/test# 切换到test目录cd /Users/wangsaichao/Desktop/test# 创建并初始化git库git init# 链接到远程git仓库 -t main 使用 main 分支git remote add origin -t main https://github.com/hannah-bingo/js-challenges.git# 将远程git库下载到本地git pull origin main
# 将目录下所有文件都增加到本地库中。
git add .# 提交更改到本地仓库
git commit -am '提交注释'# 将本地的master分支改为main分支, github为避免联想奴隶制。在持续的外界影响之下,默认分支由master改为main。
# 但是git工具默认init还是创建的master分支 所以要改成main分支。
git branch -M main# 将本地修改推到github上
git push -u origin main
墙:
Git Branches: List, Create, Switch to, Merge, Push, & Delete
- 直接上英语哇,没几个单词不认识😂
NOTE: The current local branch will be marked with an asterisk (*).
To see local branches, run this command:
git branch
To see remote branches, run this command:
git branch -r
To see all local and remote branches, run this command:
git branch -a
git checkout -b my-branch-name
local : git checkout my-branch-name
switch to a breach that came from a remote repo
git pull
git checkout --track origin/my-branch-name
本地仓库does not exist在远端
git push -u origin my-branch-name
git push -u origin HEAD
If your local branch already exists on the remote
git push
git checkout master
git merge my-branch-name
git push origin --delete my-branch-name
git branch -d my-branch-name
git branch -D my-branch-name
NOTE: The -d option only deletes the branch if it has already been merged. The -D option is a shortcut for --delete --force, which deletes the branch irrespective of its merged status.