提交合并拉推的顺序是什么?

时间:2016-02-16 09:36:57

标签: git git-branch git-push git-pull

我是从远程git服务器克隆的。

我已经从我的本地主人创建了一个新的分支(例如dev),并对代码做了一些工作 我做这些工作将我的更改发送到远程仓库。它们是正确的顺序吗?

  1. 在dev分支上提交更改

  2. 结帐到主分行

  3. 从主设备上的dev合并

  4. 从远程仓库拉

  5. 将我的主人推送到远程仓库

2 个答案:

答案 0 :(得分:0)

你的确走在正确的轨道上。

这是工作的方式 您进行更改,提交并推送它们。

# Checkout the branch you wish to start from
git checkout base_branch    

# Checkout your new branch
git checkout -b new_branch

# Change your code and add it to the staging area
git add -A . 

# Commit the code to the new branch
git commit -m "Message"

# Update the local repo with the latest code    
git fetch --all --prune

# Checkout the base branch
git checkout base_branch

# Update the local branch
git pull origin base_branch

# Merge the changes to your base branch
git merge new_branch

# Push the changes to the server
git push origin base_branch

答案 1 :(得分:0)

我宁愿做这些步骤:

  1. 在dev分支上提交更改
  2. 将提交推送到远程开发分支
  3. 结帐到主分行
  4. 从远程仓库拉
  5. 从主人的开发中合并
  6. 将我的主人推送到远程仓库
相关问题