繁体   English   中英

如何将我的更改推送回 git 中的源代码

[英]How to push my changes back to the source code in git

我在github中创建了一个项目,然后对这个项目进行了git 克隆,以将所有源代码下载到我的机器上。

我对源代码做了一些修改,我的问题是:-

  1. 如何将我的更改提交到本地 git 存储库以及 github 中的分叉存储库?
  2. 原始源代码的作者将如何从 github 中的分叉存储库中提取我的更改
  1. 如何将我的更改提交到本地 git 存储库以及 github 中的分叉存储库?

要为提交添加文件更改,请使用以下命令。

git add .

然后,通过

git commit

进行本地提交后,您可以将其推送到远程 GitHub 分支。

git push
  1. 原始源代码的作者将如何从 github 中的分叉存储库中提取我的更改

要使您的源代码被原始 fork 拉取,您必须向项目所有者发送拉取请求

  1. Go 到 GitHub 上分叉项目的 web 页面。
  2. 点击页面右上角的拉取请求按钮
  3. Select 要通过更改提交按钮提交的提交。
  4. 写下您的更改、评论等的一些描述。
  5. 发送拉取请求并等待所有者回复。
  • 这是简单的方法:
    1. git 添加。
    2. git commit -m "最终更改"
    3. git 远程添加源网址(在 url 添加您的存储库的地址)
    4. git 远程-v
    5. git 推-f
    6. git 推源主机

检查这个
使用 GIT,我如何有选择地从另一个“叉子”中提取/合并更改?
How to commit my changes to the local git repository
git commit -m "Your Message"

How to commit my changes in forked repository in github? http://www.backdrifter.com/2011/02/09/working-on-forked-projects-using-github/
http://help.github.com/fork-a-repo/

How will the author of the original source code, pull my changes from the forked repository in github
如何显示已上演的更改?
http://www.kernel.org/pub/software/scm/git/docs/git-pull.html
http://www.kernel.org/pub/software/scm/git/docs/everyday.html

    follow these steps:
    git init (To initialize the repository as git)
    git add .( To add the changes to staging area)
    git commit -m "this is my first commit" ( Initialize it as a commit with the message)
    git add remote origin url (in url add the address of your repository)
git pull origin master(to pull all the commits first otherwise they would be overridden)
    git -f push origin master(force push the chances to remote in the branch named master)

我正在使用已部署的密钥( ssh )与 http 和用户/通行证( Repo -> Settings -> Deploy Keys

因此,在我git clone我的仓库后,我必须手动更改(或使用git remote添加新的)以下内容:

[remote "origin"]
    url = https://github.com/USERNAME/REPOSITORY.git
    fetch = +refs/heads/*:refs/remotes/origin/*

至:

[remote "origin"]
    url = git@github.com:USERNAME/REPOSITORY.git
    fetch = +refs/heads/*:refs/remotes/origin/*

然后我确保在ssh-add -l ( agent ) 中找到了我的密钥,然后我只是git push

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM