Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Information about git commands for contributing to other repositories #31

Closed
bvssvni opened this issue Mar 24, 2014 · 4 comments
Closed

Comments

@bvssvni
Copy link
Member

bvssvni commented Mar 24, 2014

  1. Fork the repository by clicking the 'Fork' button on Github. This will copy the repository to your own Github account.
  2. Clone your repository to local hard drive. This is the same as when creating a new repository on Github and starting to work on it locally.
  3. Add 'upstream' remote with the command:
git remote add upstream <url>

The upstream remote should point to the original repository which you like to contribute to. After you do local commits you can pull from upstream with the command

git pull --rebase upstream master

This will update your master with commits from upstream and then apply your commits on top of them. Now you can push to your Github fork and then send a pull request.

git reset --soft upstream/master

This will merge your commits and open them for editing so you can write a new commit message.

Squashing commits

If you need to squash the last 2 commits, you write:

git reset --hard HEAD~2
git merge --squash HEAD@{1}

Then you can write a new commit message.
If you get a conflict when trying to merge, you can use:

git push --force origin master

@bvssvni
Copy link
Member Author

bvssvni commented Mar 25, 2014

The following command can be used to create a new branch with the updates from upstream by replacing the text <new branch name> with a description of what you are working on:

git fetch upstream master && git checkout upstream/master && git checkout -b <new branch name>

@bvssvni bvssvni changed the title Add git commands to wiki for contributing to other repositories Information about git commands for contributing to other repositories Mar 30, 2014
@bvssvni bvssvni closed this as completed Mar 30, 2014
bvssvni referenced this issue in PistonDevelopers/piston May 18, 2014
Have testet this on windows with rust-snake, and it worked. Also the
file gl.es has been renamed to gl_back_end.rs.
@bvssvni
Copy link
Member Author

bvssvni commented Jul 13, 2014

Some commands that reduces many merge commits:

git fetch upstream; git rebase upstream/master

git pull --ff-only upstream master

@HayleyDeckers
Copy link

Question: Should collaborators accept their own pull requests, or should this be left up to the maintainers of each individual repo?

@bvssvni
Copy link
Member Author

bvssvni commented Jul 31, 2015

@RDeckers Self merge is encouraged, assuming you know what you are doing, see PistonDevelopers/piston#674

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants