I can use some help with a pull request

Hi all,

I’m not sure if my actions on my pull request were correct… Hopefully someone can comment on it…

Using the Github web interface, I forked ‘https://github.com/ansible/ansible’. I used that same interface to
edit and add files, and comitted to my fork. Apparently that branch is called ‘devel’ since the fork was
done from the Ansible ‘devel’ branch. From there I issued a pull request.

Recently Ansibot mentioned that I should rebase, which is obviously no surprise after a while.
I could not find a way to use the web interface to do that, so I used the commandline interface on my
Linux laptop :

$ git clone https://github.com/PieterVoet/ansible.git
$ cd ansible
$ remote add upstream https://github.com/ansible/ansible.git

initially I used

$ git fetch upstream devel
$ git rebase -i upstream/devel

rename all but first ‘pick’ to ‘squash’
save

$ git commit
$ git push -f origin devel

but the web interface for my pull request did not show the commits, and the status still remained ‘needs rebase’.
After some days, I tried :

$ git pull upstream devel --rebase
$ git push origin HEAD:devel
$ git pull upstream devel --rebase

now I got some messages about confilcts, so I edited my files and saved

$ vi lib/ansible/plugins/strategy/init.py
$ vi lib/ansible/modules/utilities/logic/set_extra_var.py
$ git add lib/ansible/modules/utilities/logic/set_extra_var.py
$ git add lib/ansible/plugins/strategy/init.py
$ git commit
$ git push origin HEAD:devel

I now can see the commits in the web interface, but it now also says :

‘wants to merge 367 commits into ansible:devel from PieterVoet:devel’

Oww… now I get confused… I did not expect the commits that I got from the rebase to be commits
for my own pull request… Maybe I really messed up…

Can someone please verify my steps and check if I did someting wrong ? If so, what should
I do to correct ?
Thanks in advance for any help .

btw. my pull request is #19007

Hi Pieter

You did everything right expect one thing. Never commit to the devel
branch, create a new branch from the devel branch and commit to this.

Since you already commited to the devel branch just do the following:

# make sure you are on the devel branch first
git checkout devel

# branch off the devel branch
git checkout -b feature/xyz
git push origin feature/xyz

In your case you now have all the commits in the new branch, not reset
the devel branch to the state of the upstream devel

git checkout devel
git reset --hard upstream:devel

your devel branch has now the state of the upstreams devel again

Regards
René

Hi Rene,

thanks a lot for your help !
I executed the steps you gave me, but the last step gives an error :

$ git reset --hard upstream:devel
fatal: Invalid object name ‘upstream’.

I have defined ‘upstream’ as a remote

$ git remote -v
origin https://github.com/PieterVoet/ansible.git (fetch)
origin https://github.com/PieterVoet/ansible.git (push)
upstream https://github.com/ansible/ansible.git (fetch)
upstream https://github.com/ansible/ansible.git (push)

could you maybe please comment on this a bit more ? Thanks again !

​That should be a slash, not a colon:


git reset --hard upstream/devel ​

​Serge​

Thanks Serge,

unfortunately it then says :

$ git reset --hard upstream/devel ​
fatal: Cannot do hard reset with paths.

​That Should Not Happen™

Do you by any chance have a folder upstream/devel at your $PWD?​

Serge

Good hunch, but no, there’s no directory ( of file ) called ‘upstream’…

… and I also noticed that the ‘needs_rebase’ label is still there… ???

Hi all,

I just read about the 2.3 Core Freeze that’s coming up. I’m not sure if my pull request is in a valid
state for being eligible to be part of 2.3. Can somebody please verify if pull request #19007
is sane ?

Thanks in advance…

Sorry, it looks like you have masses of unrelated commits in https://github.com/ansible/ansible/pull/19007

By the way I still think you could potentially use set_fact because facts set with set_fact do continue to exist during the run time of the rest of the playbook (even into subsequent plays within the playbook).

Hope this helps,

Jon