I have a repo that has only one file (a Jupyter notebook file). Since the file was created using Google Colab, it didn't exist in my local repo, but was only on my GitHub repo.
I just added a README file and was trying to push from my local repo to GitHub. But since the remote repo was ahead of my local one, I wasn't able to push after committing.
I then decided to pull, but since I was not familiar with the syntax, I didn't specify any parameters after git pull
. Then I tried again with git pull origin master
, but now I got an error message saying there's a bug, and the repo name changed to "master|MERGING"...I know I probably need to pull the remote into a new local branch and merge it with my master branch, but I don't know how to do it here and also am scared to mess up the whole thing... Thanks for any tips!
georg@DESKTOP-9VE7F0E MINGW64 /d/Dropbox/WorkingDir/personal-projects/tf_and_col ab (master)
$ git commit -m "Add README file"
[master 13c0b76] Add README file
1 file changed, 16 insertions(+)
create mode 100644 README.md
georg@DESKTOP-9VE7F0E MINGW64 /d/Dropbox/WorkingDir/personal-projects/tf_and_col ab (master)
$ git push origin master
To https://github.com/georgeliu1998/tf_and_colab.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/georgeliu1998/tf_and_cola b.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
georg@DESKTOP-9VE7F0E MINGW64 /d/Dropbox/WorkingDir/personal-projects/tf_and_col ab (master)
$ git checkout master
Already on 'master'
georg@DESKTOP-9VE7F0E MINGW64 /d/Dropbox/WorkingDir/personal-projects/tf_and_col ab (master)
$ git pull
remote: Enumerating objects: 20, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 18 (delta 5), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (18/18), done.
From https://github.com/georgeliu1998/tf_and_colab
0a500ee..1238317 master -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
georg@DESKTOP-9VE7F0E MINGW64 /d/Dropbox/WorkingDir/personal-projects/tf_and_col ab (master)
$ git push origin master
To https://github.com/georgeliu1998/tf_and_colab.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/georgeliu1998/tf_and_cola b.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
georg@DESKTOP-9VE7F0E MINGW64 /d/Dropbox/WorkingDir/personal-projects/tf_and_col ab (master)
$ git remote
origin
georg@DESKTOP-9VE7F0E MINGW64 /d/Dropbox/WorkingDir/personal-projects/tf_and_col ab (master)
$ git pull origin
You asked to pull from the remote 'origin', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.
georg@DESKTOP-9VE7F0E MINGW64 /d/Dropbox/WorkingDir/personal-projects/tf_and_col ab (master)
$ git pull origin master
From https://github.com/georgeliu1998/tf_and_colab
* branch master -> FETCH_HEAD
hint: Waiting for your editor to close the file... warning: failed to restrict f ile handles (2)
handle #0: 0000000000000434 (type 3, handle info (1) 0
handle #1: 0000000000000438 (type 3, handle info (1) 1
This is a bug; please report it at
https://github.com/git-for-windows/git/issues/new
To suppress this warning, please set the environment variable
SUPPRESS_HANDLE_INHERITANCE_WARNING=1
error: cannot spawn C:/Users/georg/AppData/Local/atom/bin/atom.cmd: No such file or directory
error: unable to start editor 'C:/Users/georg/AppData/Local/atom/bin/atom.cmd'
Not committing merge; use 'git commit' to complete the merge.
georg@DESKTOP-9VE7F0E MINGW64 /d/Dropbox/WorkingDir/personal-projects/tf_and_col ab (master|MERGING)
$ git push origin master
To https://github.com/georgeliu1998/tf_and_colab.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/georgeliu1998/tf_and_colab.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
georg@DESKTOP-9VE7F0E MINGW64 /d/Dropbox/WorkingDir/personal-projects/tf_and_colab (master|MERGING)
$