# Doing a pull request the right way

**URL:** <https://forum.ansible.com/t/doing-a-pull-request-the-right-way/15855>\
**Category:** Ansible Developer\
**Created:** [August 4, 2014, 6:55pm UTC](https://forum.ansible.com/t/doing-a-pull-request-the-right-way/15855 "2014-08-04T18:55:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_Cesar](https://avatars.discourse-cdn.com/v4/letter/n/b9e5f3/32.png) [@Nicolas\_Cesar](https://forum.ansible.com/u/Nicolas_Cesar)\
**Post date:** [August 4, 2014, 6:55pm UTC](https://forum.ansible.com/t/doing-a-pull-request-the-right-way/15855/1 "2014-08-04T18:55:30Z")

</div>

Hi there,

So I’m trying to contribute an small enhancement to ansible.

That you can find it here:  
[https://github.com/nicocesar/ansible/commit/f03b1ce59e2581a105e27afb4e776333ac29cb56](https://github.com/nicocesar/ansible/commit/f03b1ce59e2581a105e27afb4e776333ac29cb56)

but my pull request isn’t the cleanest one:  
[https://github.com/ansible/ansible/pull/8434](https://github.com/ansible/ansible/pull/8434)

I still need to get better skills on github forking and merging and stashing. Could someone give me a hint what should I be doing? I was about to destroy my nicocesar/ansible copy and create a new fork just for this pull request. It’s like using a cannon for a mosquito. Hints?

Thanks in advance,  
Nico

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [August 4, 2014, 7:10pm UTC](https://forum.ansible.com/t/doing-a-pull-request-the-right-way/15855/2 "2014-08-04T19:10:38Z")

</div>

Hi Nicolas,

The first rule of PR club is to _always_ make changes on a separate branch, and not the main devel branch, like you did now. If you follow that, you’ll notice you won’t run as quickly in trouble.

When you want to update that branch, don’t do merges, but rebases (‘git rebase devel’ from your feature branch instead of ‘git pull’)

From your repo, with your patch now on _devel_, follow these steps:

(this is from the top of my head…! I’m not responsible if you kill any kittens!)

- git checkout -b version\_check  
now, you have a copy of your work in this separate branch
- git reset --hard `[f03b1ce](https://github.com/nicocesar/ansible/commit/f03b1ce59e2581a105e27afb4e776333ac29cb56)`  
`get rid of the merge commits and keep just a feature branch`
- `git fetch origin`  
`git checkout devel`  
`git reset --hard origin/devel`  
(or instead of origin whatever you called the ansible upstream remote)
- git checkout version\_check  
git rebase origin  
git push origin --set-upstream version\_check

Now do a new PR from this branch.

HTH,

Serge

---

<div class="post-metadata">

**Author:** ![Nicolas\_Cesar](https://avatars.discourse-cdn.com/v4/letter/n/b9e5f3/32.png) [@Nicolas\_Cesar](https://forum.ansible.com/u/Nicolas_Cesar)\
**Post date:** [August 4, 2014, 7:44pm UTC](https://forum.ansible.com/t/doing-a-pull-request-the-right-way/15855/3 "2014-08-04T19:44:45Z")

</div>

Serge, Thanks so much or your time and the detailed explanation …

Didn’t worked out of the box, but for sure it helped to get what I wanted.

Please do a check to my new pull request:  
[https://github.com/ansible/ansible/pull/8434](https://github.com/ansible/ansible/pull/8434)

Should be correct.

BTW, had to do a pull --force in order to make the changes that I wanted on github.

Thanks again,  
Nico

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 4, 2014, 8:28pm UTC](https://forum.ansible.com/t/doing-a-pull-request-the-right-way/15855/4 "2014-08-04T20:28:24Z")

</div>

FYI: The above looks like it may be a link to the previous pull request still.

---

<div class="post-metadata">

**Author:** ![Nicolas\_Cesar](https://avatars.discourse-cdn.com/v4/letter/n/b9e5f3/32.png) [@Nicolas\_Cesar](https://forum.ansible.com/u/Nicolas_Cesar)\
**Post date:** [August 4, 2014, 8:29pm UTC](https://forum.ansible.com/t/doing-a-pull-request-the-right-way/15855/5 "2014-08-04T20:29:51Z")

</div>

Oops. … I meant [https://github.com/ansible/ansible/pull/8436](https://github.com/ansible/ansible/pull/8436)

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 4, 2014, 8:42pm UTC](https://forum.ansible.com/t/doing-a-pull-request-the-right-way/15855/6 "2014-08-04T20:42:08Z")

</div>

Thanks!

Looks like you may need to rebase this one. I suspect you may be rebasing against your branch and not upstream, which is why it appears to still have a conflict.
