How do you create a remote Git branch?

Simple Git 2.0+ solution: As of Git 2.0, the behavior has become simpler: You can configure git with push.default = current to make life easier: I added this so now I can just push a new branch upstream with -u will track remote branch of the same name. Now with this configuration, you will auto-guess the remote reference to … Read more

Get a list of all git commits, including the ‘lost’ ones

Not particularly easily- if you’ve lost the pointer to the tip of a branch, it’s rather like finding a needle in a haystack. You can find all the commits that don’t appear to be referenced any more- git fsck –unreachable will do this for you- but that will include commits that you threw away after a git commit … Read more

Why do I have to “git push –set-upstream origin “?

TL;DR: git branch –set-upstream-to origin/solaris The answer to the question you asked—which I’ll rephrase a bit as “do I have to set an upstream”—is: no, you don’t have to set an upstream at all. If you do not have upstream for the current branch, however, Git changes its behavior on git push, and on other commands as well. The … Read more

How to git rebase a branch with the onto command?

I have noticed that the two blocks of following git commands have different behaviours and I don’t understand why. I have an A and a B branches that diverge with one commit I want to rebase B branch on the lastest A (and have the commit on the B branch) No problem if I do: But if I do: It doesn’t work at all, nothing happens. … Read more

GitHub: invalid username or password

https://[email protected]/eurydyce/MDANSE.git is not an ssh url, it is an https one (which would require your GitHub account name, instead of ‘git‘). Try to use ssh://[email protected]:eurydyce/MDANSE.git or just [email protected]:eurydyce/MDANSE.git The OP Pellegrini Eric adds: That’s what I did in my ~/.gitconfig file that contains currently the following entries [remote “origin”] [email protected]:eurydyce/MDANSE.git This should not be in your global config (the one in ~/).You could check git config … Read more

Undo git pull, how to bring repos to old state

Running git pull performs the following tasks, in order: git fetch git merge The merge step combines branches that have been setup to be merged in your config. You want to undo the merge step, but probably not the fetch (doesn’t make a lot of sense and shouldn’t be necessary). To undo the merge, use git reset –hard to reset the local repository to … Read more