git 日常操作常用命令整理

GIT常用命令简写设置

-- 查看当前分支状态
git config --global alias.st  "status"

-- 切换分支
git config --global alias.co  "checkout"

-- 提交
git config --global alias.ci  "commit"

-- 分支操作
git config --global alias.br  "branch"

-- 暂存
git config --global alias.sh  "stash"

-- 合并分支
git config --global alias.mg  "merge"

-- 拉取最新代码
git config --global alias.pl  "pull"

-- 将代码推向分支
git config --global alias.ph  "push"


=====================================================================
GIT常用命令

例如:现有[test]和[test2]2个分支,一般test作为小组开发合并主分支,其它人用各自分支,最后功能无误合并到test并提交

-- 查看所有分支
git branch -a


-- 将自己分支修改部分添加并提交到本地仓库
git ci -a -m "入库单功能完成"


-- 查看自己分支状态
git status


-- 切换到test主分支
git checkout test


-- 从远程服务器获取他人最新提交修改(PS:pull命令默认是更新当前使用分支)
git pull


-- 将test2合并到test分支
git merge test2


-- 将合并后的提交到远程服务器(PS:push命令默认是提交当前使用分支)
git push


-- 不切换分支,获取其它分支代码,并自动合并
-- 例如:将test分支拉取过来
git pull origin test

=====================================================================
maven 重新编译
mvn clean install -Dmaven.test.skip=true


mavean 启动程序(main方法所在包),进入到项目磁盘目录【spring-web】,启动git客户端,运行以下命令即可
mvn clean spring-boot:run


Jetty 启动程序
mvn clean jetty:run


提交代码:

git  add . 

git commit -a -m "描述"

git checkout test  【切换到test分支】

git pull origin test  【拉取其他人修改的内容】

git merge my  【拉取my分支上修改的内容】

git push origin test  【往代码仓库提交】


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值