如何将我的更改推送回 git 中的源代码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7036193/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to push my changes back to the source code in git
提问by Jason
I forked a project in githuband then did a git cloneon this project to get all the source code to my machine.
我在github 上fork 了一个项目,然后在这个项目上做了一个git clone来把所有的源代码都放到我的机器上。
I have made some modifications to the source code and my questions are:-
我对源代码做了一些修改,我的问题是:-
- How to commit my changes to the local git repository as well as my forked repository in github?
- How will the author of the original source code, pull my changes from the forked repository in github
- 如何将我的更改提交到本地 git 存储库以及我在 github 中的分叉存储库?
- 原始源代码的作者将如何从 github 中的分叉存储库中提取我的更改
回答by dlackty
- How to commit my changes to the local git repository as well as my forked repository in github?
- 如何将我的更改提交到本地 git 存储库以及我在 github 中的分叉存储库?
To add files changes for commit, use the following command.
要为提交添加文件更改,请使用以下命令。
git add .
then, make a local commit by
然后,通过本地提交
git commit
once you make your local commit, you can then push it to your remote GitHub fork.
进行本地提交后,您可以将其推送到远程 GitHub 分支。
git push
- How will the author of the original source code, pull my changes from the forked repository in github
- 原始源代码的作者将如何从 github 中的分叉存储库中提取我的更改
To make your source code pulled by original fork, you have to send a pull requestto the project owner.
为了让你的源代码被原始 fork 拉取,你必须向项目所有者发送拉取请求。
- Go to the web page of your forked project on GitHub.
- Hit the pull requestbutton on the top right of page
- Select the commits that you want to submit by change commitsbutton.
- Write some description of your changes, comments, or etc.
- Send pull requestand wait for the owner reply.
- 转到 GitHub 上分叉项目的网页。
- 点击页面右上角的拉取请求按钮
- 通过更改提交按钮选择要提交的提交。
- 写下您的更改、评论等的一些描述。
- 发送拉取请求并等待所有者回复。
回答by Kracekumar
Check this
Using GIT, how can I selectively pull / merge changes from another's 'fork'?How to commit my changes to the local git repository
git commit -m "Your Message"
检查这个
使用 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 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
How do I show the changes which have been staged?
http://www.kernel.org/pub/software/scm/git/docs/git-pull.html
http://www.kernel.org/pub/software/scm/git/docs/everyday.html
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
回答by Priyanka Arora
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)
回答by suraj kumar
- Here's the simple way :
- git add .
- git commit -m "Final Changes"
- git remote add origin url(in url add the address of your repository)
- git remote -v
- git push -f
- git push origin master
- 这是简单的方法:
- git 添加。
- git commit -m "最终更改"
- git remote add origin url(在url中添加你的仓库地址)
- git远程 -v
- git push -f
- git push origin master