簡體   English   中英

如何推入我的分支並從git大師那里拉

[英]how to push in my branch and pull from master git

執行以下順序是否合適:

git add [file names]
git commit [comments]
git checkout master
git pull
git checkout [my branch]
git merge master
git push

如何能夠推送到不同的分支名稱?

您快到了,但是您錯過了一些重要的步驟:

# Add the desired files to stage area
git add [file names]

# commit the changes
git commit [comments]

# switch to master branch
git checkout master

# git pull
# This is dangerous !!! if you are using git version <2.0

在這里閱讀原因(第一段)。


如何以簡單的方式做到這一點:

# Commit changes to your local branch 

# pull changes from the remote branch to your branch
# since you are already on your branch - you dont need to switch 
# to master branch. Simply grab the remote copy and merge it into
# your local branch using the pull command.
git pull origin master

# now your changes are merged with master
git push origin <branch_name>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM