Reputation: 13160
I have always worked with git and opensrc in a very simple limited way
This works for a single change.
If I make more changes on my computer and commit them and push before the pull request is accepted then they get added to the same pull request. I know this is not ideal so I try and wait for first pull request to be accepted before making further changes but this is not always possible.
So I understand that ideally you are meant to create separate branches for each bug fix. So I made a new branch, made changes, committed the changes and pushed them back to github. But i cant see this new branch on github and I am not sure hwhat I am meant to do next ?
When I run git push on this new branch I get
ubuntu@ip-172-31-39-147:~/code/discogs-xml2db/speedup$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
In Git 2.0, Git will default to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
I didn't get this when I pushed on the other branch, does this mean the push has not actually happened ?
Update so I tried Schwerns advice, the command as is didn't quite work but adding setup upstream origin did work it the changes were pushed to github, and I now see this new branch on github.
ubuntu@ip-172-31-39-147:~/code/discogs-xml2db/speedup$ git config --global push.default simple
ubuntu@ip-172-31-39-147:~/code/discogs-xml2db/speedup$ git push
fatal: The current branch releasestatus has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin releasestatus
ubuntu@ip-172-31-39-147:~/code/discogs-xml2db/speedup$ ^C
ubuntu@ip-172-31-39-147:~/code/discogs-xml2db/speedup$ git push --set-upstream origin releasestatus
Username for 'https://github.com': ijabz
Password for 'https://[email protected]':
Counting objects: 17, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 600 bytes | 0 bytes/s, done.
Total 6 (delta 5), reused 0 (delta 0)
remote: Resolving deltas: 100% (5/5), completed with 5 local objects.
remote:
remote: Create a pull request for 'releasestatus' on GitHub by visiting:
remote: https://github.com/ijabz/discogs-xml2db/pull/new/releasestatus
remote:
To https://github.com/ijabz/discogs-xml2db.git
* [new branch] releasestatus -> releasestatus
Branch releasestatus set up to track remote branch releasestatus from origin.
Upvotes: 0
Views: 227
Reputation: 165586
I don't think you ever pushed your changes to Github. Git is telling you it's not fully configured and you need to fix that.
git push
actually has two more parts: where to push to (the "remote"), and which branch to push to. When you're on your master branch git push
is really git push origin master
. The remote repository you cloned from is called "origin" and Git knows your master branch came from it's master branch.
When you make a new branch, Git doesn't know where you want to push it to. If you run git push
on your new branch it will have to guess. push.default
tells Git how to guess, and it's not set.
You can read git-config
to learn more about the options, but I recommend setting it to simple
. It will guess that you want to push it to a branch with the same name as your own.
git config --global push.default simple
Now you should be able to git push
to Github.
You can also spell it out for Git: git push origin <name of your branch>
.
Upvotes: 1