git常用命令

来源:互联网 发布:win7网络克隆教程 编辑:程序博客网 时间:2024/06/05 02:38

git将本地仓库上传到远程仓库

1. git init

2. git add .

3. git commit -am "###"      -------以上3步只是本地提交

4.git remote add origin git@xx.xx.xx.xx:repos/xxx/xxx/xxx.git

5.git push origin 本地分支:远程分支


clone代码
1. 在git命令行界面到工作目录
cd 代码目录
2. clone 远程代码
git clone + 地址
3. 创建分支
git branch + 分支名
git checkout -b + 分支名
4. 查看已有分支
git branch -a

提交文件
1. 查看更改文件
git status 
2. 添加文件
git add 文件路径+文件名
git add 文件路径+*(提交多个文件)
3. 查看添加的文件
git status
4. 提交修改的文件
git commit -am "注释"


分支代码合并到develop
1. 切换到develop 分支
git checkout develop
2. 获取develop分支代码(一定)
git pull origin develop 
3. 合并分支代码
git merge (分支名)
4. 更新到父分支
git push origin develop 这个与有很
或者(下面的不会合并)
git remote update
git rebase origin/release

提交完成回到子分支
1. 切换到子分支
git checkout zhoubo
2. 查看文件状态
git status
3. 设置分支
git rebase develop

分支更改的东西暂存
1. 切换到要保存的分支
git checkout zhoubo
2. 暂存
git stash
3. 查看暂存记录
git stash list
4. 退出:
q
5. 调出暂存的代码
git stash pop
git stash apply stash@{1}

常用命令 
1. 删除分支:
git branch -d + 分支名
2. 取消更改:
git checkout + 文件名
3. 清空暂存区:
git stash clear
4.提交过程
add
    git push origin/release

0 0
原创粉丝点击