将login分支中的代码提交到本地仓库,合并到master分支推送到远端
git status:查看当前项目中源代码的状态git add .:将修改后文件和新增文件添加到暂存区git commit -m "提交的文本说明信息":提交暂存区代码到本地仓库git branch:查看分支git checkout -b login:新建一个user分支,并切换到这个分支,执行后,当前处于该分支,当前所有的修改也切换到了这个分支中git push -u origin lohin:将本地的login分支推动到云端origin仓储里的login分支(远端没有此分支,该分支的第一次推送)git checkout master:切换分支到mastergit merge login:合并分支git push:推送git remote rm origin:远程起源已存在时先输入这个git branch -d login:删除本地的login分支git push origin --delete login:删除远程的login分支
坑
-
报错
! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://xxxxxxxxxxxxxxxxxxx.git'
解决:git pull origin master --allow-unrelated-histories同步远程仓库- 如果仓库中有一个说明文件,可能会进入vim编辑模式,
esc -> : -> q! -> enter退出即可 git push origin master重新提交- 如果提示本地未提交,就重新
add commit
-
出现
warning: LF will be replaced by CRLF in .....解决:
执行以下git config --global core.autocrlf false即可