Hi
I'm new in git. So, before doing something wrong, I need help to make
this works... I need to create a new local branch and push it to the
devel branch on github? How Can I do it?
Never commmit to the devel branch!
First of all, you should have a "fork" on github of ansible. If you don't, create one now by clicking the fork button on github.
On your local git repo, the "origin" repo points to the repo you cloned from, if you cloned directly from ansible's repo, you should change it, because you do not have write permissions, so you can not "push" anything to it.
In this case rename the branch to "upstream" e.g. and add your fork as "origin" doing it like this:
git remote rename origin upstream
git remote add origin <url>
Then a little advice, never do commits to the devel branch. It belongs to the project and you will mess up with unnecessary merges.
So before you commit, make a new local branch
git checkout -b feature/<foo>
If you already did commits to devel, no problem. Make a branch, so you commits also go into that branch and then reset devel to the state it had without your commits.
git checkout -b feature/<foo>
git checkout devel
git log
... remember the commit id right before your commits
git reset --hard <commit-id>
if you pushed the devel branch to your github fork already, reset this branch also:
git push origin devel -f
Thats it.
Now you did commits you want to push your branch to your github fork repo:
git push origin feature/<foo>
And make a pull request on the webinterface on github. If you found something you want to have changed without making a new commit? No problem:
... make changes to the file
git add <file>
git commit --amend
... optionally change commit message
git push origin feature/<foo> -f
Little advice here, this will rewrite the history and if you work with colleagues on a project, never rewrite history or your colleagues will get mad.
So the safe way would be just without --amend and without -f, which just adds a new commit.
... make changes to the file
git add <file>
git commit
git push origin feature/<foo>
To get all new stuff from ansible project, so called "upstream" repo.
git pull upstream devel