Jump to content
  • Advertisement
Sign in to follow this  
blueshogun96

Pushing changes to github?

This topic is 1565 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm posting this here, because I don't know where I'd post this.

 

I'm a complete n00b to github, and I can't get the thing to work to save my life.  So, I found this tutorial and followed it *almost* to the T (I added a few source files to the mix).  So, here I am at the very last step (git push origin master) , and I get this error message:

 

 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/blueshogun96/KunaiEngine.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.
 
What?  I just created this stupid thing!  What is it talking about?
 
If it matters, I'm using MacOSX and doing everything using the terminal (please, no OSX trolling).  Any ideas?  Thanks.
 
Shogun.

Share this post


Link to post
Share on other sites
Advertisement
The error message is essentially saying that someone else pushed a change to github (including you, if you used a different computer), and the branch you're trying to push does not yet include the other person's changes. If you force push, the other person's changes will be lost.

Fetch, then Rebase master onto origin/master (resolve conflicts if there are any), then Push. // This moves your work so that it comes after the other person's work in the commit graph.

Alternatively:

Pull and resolve conflicts, then Push (this makes more of a mess out of the git log though) // This merges your commit with the other person's commit and makes a merge node in the commit graph.


You may have to repeat the process if the other person/people push new commits in the meantime.

In order to get the syntax right for each command, you should refer to the git documentation while you do it. I don't personally use the command line because it's fairly easy to accidentally make a typo and do something COMPLETELY different than what you want, so I don't remember the proper command line argument order to use. Edited by Nypyren

Share this post


Link to post
Share on other sites

No idea how to do that, or even what it means (fetch and rebase).  I'm still learning what is what.  Sorry if it sounds like I want to be spoon fed, but my brain is all over the place.

 

Shogun

Share this post


Link to post
Share on other sites
Try this:

git pull origin master

(solve conflicts/commit if needed)

git push origin master


In the very unlikely case it is the first time you are pushing changes to github, you can erase the project on github, start it again and push to it with --mirror.

Share this post


Link to post
Share on other sites
fetch and rebase are both literal names of git commands.

Fetch downloads commits from the remote ("remote" is interchangable with "github server" in this case), updates your local origin/* branches to point at the new commits, then exits. It does not affect your "local" branches.

Rebase copies commits to new locations in the commit graph. You tell it which commits you want to move and where you want to move them to. It has lots of different options, so you should refer to the official documentation on how to use it.


Don't worry if it sounds complicated - it usually takes a few months for an experienced programmer to become familiar with git.

You should really search on the internet for some full-length introductory guides. It takes a very long time to explain all of the information and I would just be totally redundant.

Share this post


Link to post
Share on other sites

^ Yeah, but I'd hate to spend my entire 3 day weekend spending all of my time learning git.  But for now, as long as I can push and upload changes, I'm good.

 

Try this:

git pull origin master

(solve conflicts/commit if needed)

git push origin master


In the very unlikely case it is the first time you are pushing changes to github, you can erase the project on github, start it again and push to it with --mirror.

 

This fixed it.  I tried it before, but I didn't do it right.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!