idea git 常使用命令

1、(先进入项目文件夹)通过命令 git init 把这个目录变成git可以管理的仓库

 

git init

2.状态查询命令

git status
On branch develop
Your branch is up to date with 'origin/develop'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        new file:   zhz-mapper/pom.xml
        new file:   zhz-service/pom.xml
        new file:   zhz-service/zhz-service.iml

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   .idea/compiler.xml
        modified:   pom.xml
        modified:   zhz-mapper/pom.xml
        modified:   zhz-model/pom.xml
        modified:   zhz-model/zhz-model.iml
        modified:   zhz-service/pom.xml
        modified:   zhz-service/zhz-service.iml

3、把文件添加到版本库中,使用命令 git add .添加到暂存区里面去,不要忘记后面的小数点“.”,意为添加文件夹下的所有文件

git add .

4、用命令 git commit告诉Git,把文件提交到仓库。引号内为提交说明

git commit -m '添加model、mapper、service'

5、关联到远程库

git remote add origin 你的远程库地址

如:

git remote add origin ssh://kangxg@192.168.0.99:29418/zhaizhu/server.git

6、获取远程库与本地同步合并(如果远程库不为空必须做这一步,否则后面的提交会失败)

git pull --rebase origin develop

Password authentication
Password: 
From ssh://192.168.0.99:29418/zhaizhu/server
 * branch            develop    -> FETCH_HEAD
Current branch develop is up to date.
 

7、把本地库的内容推送到远程,使用 git push命令,实际上是把当前分支master推送到远程。执行此命令后会要求输入用户名、密码,验证通过后即开始上传。

git push -u origin develop

 

 

 

命令大全

https://www.jianshu.com/p/46ffff059092
 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值