git常见命令(成长版)

ps:所谓成长版就是后续可能还会添加命令:

1.删除本地分支:

复制代码
git branch -d 分支名

2.拉取代码后默认master分支,切换到线上其他分支:

(1)查看线上所有分支:

复制代码
git branch -a

(2)本地切换到线上指定分支:

复制代码
// 以从master切换到develop为例
git checkout -b develop origin/develop

3.创建本地分支:

可通过下面命令创建本地分支。

复制代码
git branch

比如以master为准创建一个新分支:

首先应确保处于该分支下,不是的话通过checkout切换:

复制代码
git checkout 分支名

创建即可:

复制代码
git branch 分支名

4.首次提交本地新分支:

可能会出现类似下述报错

复制代码
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
......

解决方案:

复制代码
git push -u origin 本地新分支名

待补充中。。。

希望本文会对您有所帮助~ ^_^

相关推荐
Unity粉末状在校生1 小时前
Git解决fatal: Could not read from remote repository.的问题
git
少年攻城狮2 小时前
Obsidian系列---【如何使用obsidian同步到git?】
git
do better myself4 小时前
网站源码如何部署和加入GIT仓库的
git
爱学英语的程序员7 小时前
Git 提交 LF will be replaced by CRLF the next time Git touches it 报错
git
qq_339191147 小时前
服务器git pull每次都要输入密码,linux 设置git登录,linux设置git只输入一次账户密码
git
一颗小行星!13 小时前
快速理解 Git submodule
git
A-Jie-Y16 小时前
Git基础-核心概念与常用命令
git
夜珀16 小时前
Git基础修炼手册:在AtomGit上玩转版本控制
git
golang学习记16 小时前
Zed IDE官宣新招:Git Graph 正式支持!
ide·git
要记得喝水17 小时前
适用于 Git Bash 的脚本,批量提交和推送多个仓库的修改
git·elasticsearch·bash