没有远程存储库。
我的本地机器上只存在一个存储库。
所以这就是我所做的:
git branch new-branch
git checkout new-branch
//implemented some changes
//now wants to push changes to master
//what is the command?
没有远程存储库。
我的本地机器上只存在一个存储库。
所以这就是我所做的:
git branch new-branch
git checkout new-branch
//implemented some changes
//now wants to push changes to master
//what is the command?
据我了解,您要做的是将您的分支与主分支“合并”。所以尝试以下。
git branch new-branch
git checkout new-branch
//implemented some changes
//to push chages to master first checkout to master
git checkout master
git merge new-branch
听起来我在这里吹毛求疵,但在 git 中(因此在 git 文档中)你所说的你想做的不是“推”的意思。
您要做的是将您的更改“合并”到master
分支中。有关基础知识的说明,请参阅git merge
文档。 https://git-scm.com/docs/git-merge
您正在将您的提交合并到 master,而不是推送它。推送用于将本地更改发送到远程。
git branch new-branch #creates a new branch
git checkout new-branch #switches to the new branch
# implemented some changes
git add somefile #stages your changes for next commit
git commit -m "implemented some changes" #commits those changes with message
# push* (it's merge) changes to master
git checkout master #switches back to master branch
git merge new-branch #merges your changes from new-branch back into master
有关更多信息,请参阅https://git-scm.com/docs/git-merge。