如何将更改推送到分支? [英] How to push changes to branch?

查看:98
本文介绍了如何将更改推送到分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我可以访问存储库时,您能解释一下如何使用git吗?

Can you explain me how to use git in case, when I have access to repository:

  • 如何下载存储库
  • 如何在选定的分支中进行更改
  • 如何选择要推送的分支

我尝试了这些步骤

git init
git clone git.repository
git pull develop  (where develop is branch)
git add .
git commit -m "m"
git push origin develop

结果是:

* branch            develop    -> FETCH_HEAD
fatal: refusing to merge unrelated histories

我做错了什么?

推荐答案

如何下​​载存储库

How to download repository

# download a repository
git clone <url>

如何在所选分支中推送更改

How to push changes in selected branch

# push changes to remote branch
# assuming you are on the master branch right now
git push origin master

如何选择要推送的分支

How to select branch to push

 # push any desired branch to remote
 git push -u origin local_branch_name:remote_branch_name

这篇关于如何将更改推送到分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆