Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git, Git Pull and Escaping

Tags:

git

I am trying to push a branch I am working on to its remote branch. I was getting the message:

error: failed to push some refs to 'website.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

I ran git pull origin and got the message:

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.

When running git push origin branch_name I got the same error as above, so I ran git pull origin master.

I have a feeling this is not doing what I intended and now would like to escape/abort that last command somehow. My current screen reads:

From website.com

* branch            master     -> FETCH_HEAD
Auto-merging config/routes.rb

Merge branch 'master' of website into branch

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
# 
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
~                                                                                                                                                
~                                                                                                                                                
~                                                                                                                                                
~                                                                                                                                                                                                                                                                                                                                                                                                                                     

-- INSERT --

Sorry I am very new to git. Would anyone be able to explain to me how to escape this current screen and what it is looking for me to do?

like image 595
BC00 Avatar asked Dec 20 '25 01:12

BC00


1 Answers

You're currently "merging" anything new on the "master" branch that's located at "origin" into your local version of the "master" branch. When you do that it asks you to explain what you're doing with a message. Type something to say what the change is, then hit return.

To make sure everything is right, try the following. "Fetch" the latest status of the origin, pull any changes just to make sure you are up to date. Commit any new changes and then push them to the server. The "-a" commits anything that has changed. You may also need to do git add <some file that has changed>

git fetch    
git pull origin master
git commit -m"my changes" -a
git push origin master
like image 175
stef Avatar answered Dec 22 '25 15:12

stef



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!