But I get an error "! [rejected]" and something about "non fast forward"
That's because Git can't merge the changes from the branches into your current master. Let's say you've checked out branch master
, and you want to merge in the remote branch other-branch
. When you do this:
$ git pull origin other-branch
Git is basically doing this:
$ git fetch origin other-branch && git merge other-branch
That is, a pull
is just a fetch
followed by a merge
. However, when pull
-ing, Git will only merge other-branch
if it can perform a fast-forward merge. A fast-forward merge is a merge in which the head of the branch you are trying to merge into is a direct descendent of the head of the branch you want to merge. For example, if you have this history tree, then merging other-branch
would result in a fast-forward merge:
O-O-O-O-O-O
^ ^
master other-branch
However, this would not be a fast-forward merge:
v master
O-O-O
\
\-O-O-O-O
^ other-branch
To solve your problem, first fetch the remote branch:
$ git fetch origin other-branch
Then merge it into your current branch (I'll assume that's master
), and fix any merge conflicts:
$ git merge origin/other-branch
# Fix merge conflicts, if they occur
# Add merge conflict fixes
$ git commit # And commit the merge!
If you want only the remote URL, or if your are not connected to a network that can reach the remote repo:
git config --get remote.origin.url
If you require full output and you are on a network that can reach the remote repo where the origin resides :
git remote show origin
When using git clone
(from GitHub, or any source repository for that matter) the default name for the source of the clone is "origin". Using git remote show
will display the information about this remote name. The first few lines should show:
C:\Users\jaredpar\VsVim> git remote show origin
* remote origin
Fetch URL: git@github.com:jaredpar/VsVim.git
Push URL: git@github.com:jaredpar/VsVim.git
HEAD branch: master
Remote branches:
If you want to use the value in the script, you would use the first command listed in this answer.
Best Answer
2. a) Type 'LICENSE', 'LICENSE.md' or 'LICENSE.txt' as the new file's file name. b) The 'Want to use a new template?' dialog will appear.
The accepted answer is almost there, but confused me, because it said 'click the blue plus' - the interface may have changed - and the image is the same as the OP's.