On Thu, Sep 27, 2012 at 2:49 PM, Erik Molekamp <[email protected]> wrote: > Hi Jenkins devs, > > I recently joined the Jenkins community, and although I am an experienced > Java developer, I have absolutely no prior experience with GitHub, or with > git for that matter. > > My first steps have been as follows: > (and I am explicitly asking for any comments on where I went wrong, or what > I could have done differently, if not better) > > As explained on the 'Building Jenkins' wiki page: > - Clone the Jenkins repo > - Build with Maven (unfortunately the build failed because some core tests > fail on Windows) > > After reading some more GitHub help: > - Fork Jenkins > - Clone my fork > - Make a change and push it to my fork > - Create a pull request: 575 > > jglick had a useful comment on the pull request, so I wanted to make the > suggested code change. Having gotten the feedback I needed, I closed the > pull request, intending to make a fresh version of the change and push it > directly to the jenkins repo. However, I had already committed my change to > my fork, and I didn't know how to revert it, or if undoing a commit is even > possible. So I proceeded with the following: > - Delete my fork > - Create a new fork of Jenkins > - Clone my fork > - Redo the change > - Commit it, and push to my fork > > Then, on GitHub, I couldn't find how to push my change from my fork back to > jenkins. So I went back to my original clone of the Jenkins repo, opened > that project in IntelliJ, put the change there, and told the IDE to push it > to Jenkins. At first GitHub refused the push, with some error message of > needing to merge first. I wasn't sure what that meant, but guessed that my > clone was no longer in sync with the repo. So I did: > - git fetch origin > - git pull > (after this, git status said I was ahead of master by 2 commits, which I > don't understand because I had made only 1 commit: my code change. What was > the second commit?) > I then retried pushing the change from the IDE, and this time it was > accepted. Only, unexpectedly, there were indeed 2 commits, both of which > were pushed. Since only 1 was intended (8fb12c5), I was quite worried of > having broken something. The second commit, 7b9becc, had the title "Merge > branch 'master' of https://github.com/jenkinsci/jenkins", and there were > many changes in it (36 changed files), making me even more worried. It looks > like I merged some changes into master, but where did they come from? > > Going back to my pull request, I saw that jglick had some more useful > comments: > "There is no need to close a pull request after a comment; just push a new > change to your branch. (You used master—OK but better practice to create a > branch for the change, so you can have multiple pull requests open at > once.)" > > I didn't fully understand this yet. How could I add more changes to a pull > request? Triggered by the 'branch' part, I looked up branching on GitHub > help, and continued, on the local clone of my fork: > - git branch mybranch > - git checkout mybranch > > So now I have a branch of my fork, I have made another code change, and I > want to create a new pull request from it. In the meantime I read on the > help that you should use a separate branch for a pull request, and that any > changes you push to that branch are added to the pull request. That's all > good and well, but I still can't manage to create a pull request from by > branch, because I can't find my branch on GitHub. It seems to exist only on > my local computer. How do I push the branch to GitHub?
git push origin <branchname> will update github with your branch. HTH, Andrew > > That's where I'm at now. Can you help me along further on this learning > curve? Any and all comments are welcome. > > Thanks to jglick for his helpful feedback, even if I had to read it a few > times over before understanding (which is entirely due to my ignorance, not > the quality of the comments). > > > Best regards, > Erik Molekamp -- -- Andrew Melo
