Working with Git

Ryan Schmidt ryandesign at macports.org
Thu Nov 3 18:48:15 PDT 2016


> On Nov 3, 2016, at 10:36 AM, Lawrence Velázquez <larryv at macports.org> wrote:
> 
>> On Nov 2, 2016, at 11:24 PM, Ryan Schmidt <ryandesign at macports.org> wrote:
>> 
>> Yes, there are "command line instructions" on the web site, but they
>> are different from the commands you gave below, which are again
>> different from other commands suggested in previous threads, so it is
>> difficult to know which set of instructions to follow.
> 
> Obviously I think you should follow mine ;)
> 
> The GitHub instructions assume that you're okay with nonlinear history
> (they create merge commits), so we can't really use them. But I found
> them useful for developing my instructions.

Your instructions and theirs already differ in the way in which the branch changes are obtained.

You said:

> To obtain the submitter's changes:
> 
> 	$ git fetch https://github.com/l2dy/macports-ports.git curl-ca-bundle-update
> 	$ git checkout -b l2dy-curl-ca-bundle-update FETCH_HEAD
> 	$ git rebase master l2dy-curl-ca-bundle-update
> 
> The first command imports changes from the submitter's
> "curl-ca-bundle-update" branch. The second command creates a new local
> branch to match. The third command transplants the submitter's changes
> onto the top of your master branch. (Rebasing will fail if the
> submitter's changes don't apply cleanly to the current ports tree. You
> can just ask them to fix this themselves and push a new branch.)
> 
> Now you can check out the new branch and try out the submitter's
> changes. You can also modify the branch as you see fit.
> 
> 	$ git checkout l2dy-curl-ca-bundle-update

They say:

> Step 1: From your project repository, check out a new branch and test the changes.
> 
> git checkout -b l2dy-curl-ca-bundle-update master
> git pull https://github.com/l2dy/macports-ports.git curl-ca-bundle-update




>> Thanks, that worked, up until the "git push origin master" command,
>> which asked me to authenticate, and supplying my username and password
>> was unsuccessful:
>> 
>> $ git push origin master
>> Username for 'https://github.com': ryandesign
>> Password for 'https://ryandesign@github.com': 
>> remote: Invalid username or password.
>> fatal: Authentication failed for 'https://github.com/macports/macports-ports.git/'
> 
> That's curious. What does "git remote -v" print?

$ git remote -v
origin	https://github.com/macports/macports-ports.git (fetch)
origin	https://github.com/macports/macports-ports.git (push)

Possibly relevant: I do, of course, use two-factor authentication, but I just supplied my password; I was not asked to provide a two-factor auth token. I remember having to follow some instructions to set up GitHub Desktop with some kind of access to allow it to commit, but that was months ago so I couldn't tell you what I did.


>> Now I still seem to have this branch in my local git repo:
>> 
>> $ git branch
>> l2dy-curl-ca-bundle-update
>> * master
>> 
>> Can I delete it? With, I presume, "git branch -d l2dy-curl-ca-bundle-update"?
> 
> Yeah, you can delete it. You should NOT use "git branch -D" as Sterling
> suggested because these instructions are designed so that you can always
> fast-forward merge the PR branch into master. If "git branch -d" fails,
> something is not right, and you have to go back and figure out what.

I did already run "git branch -D l2dy-curl-ca-bundle-update" when  "git branch -d l2dy-curl-ca-bundle-update" failed because of an error.


> One small addendum: Before "git push origin master", you should run "git
> pull --rebase" to get any new commits that were pushed by other
> committers.

I assume if this was necessary I would have received an error message when I tried to push?




More information about the macports-dev mailing list