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

You have not concluded your merge (MERGE_HEAD exists)

OK. The problem is your previous pull failed to merge automatically and went to conflict state. And the conflict wasn’t resolved properly before the next pull. Undo the merge and pull again.To undo a merge:git merge –abort [Since git version 1.7.4]git reset –merge [prior git versions] Resolve the conflict. Don’t forget to add and commit the merge. … Read more

What is the difference between ‘git pull’ and ‘git fetch’?

In the simplest terms, git pull does a git fetch followed by a git merge. You can do a git fetch at any time to update your remote-tracking branches under refs/remotes/<remote>/. This operation never changes any of your own local branches under refs/heads, and is safe to do without changing your working copy. I have even heard of people running git fetch periodically in a cron … Read more

How to name and retrieve a stash by name in git?

I was always under the impression that you could give a stash a name by doing git stash save stashname, which you could later on apply by doing git stash apply stashname. But it seems that in this case all that happens is that stashname will be used as the stash description. Is there no way to actually name … Read more

How do you stash an untracked file?

To stash your working directory including untracked files (especially those that are in the .gitignore) then you probably want to use this cmd: Alternatively, you can use the shorthand -u instead of –include-untracked, or simply git stash –all which stashes all files, including untracked and ignored files. This bahaviour changed in 2018, so make sure your git is up to date. Warning: there seems to … Read more