Git, Git Pull and Shutdown

I am trying to push a branch I am working on to my remote branch. I got a 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.

      

git push origin branch_name

I got the same error as above on startup , so I ran git pull origin master

.

I have a feeling that I am not doing what I wanted and now I would like to somehow avoid this last command. 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'm very new to git. Can anyone please explain to me how to avoid this current screen and what it is looking for me to do?

+3


source to share


1 answer


You are currently "merging" anything new into the "master" branch that is at "origin" in your local version of the "master" branch. When you do, he will ask you to explain what you are doing with the message. Enter something to say what the change is, then hit return.

To get it right, try the following. "Fetch" the latest status of the source, pull all changes to make sure you are up to date. Commit any new changes and then push them to the server. "-a" does whatever has changed. You may also needgit add <some file that has changed>



git fetch    
git pull origin master
git commit -m"my changes" -a
git push origin master

      

+2


source







All Articles