Jump to content

  • Log In with Google      Sign In   
  • Create Account

Pushing changes to github?

  • You cannot reply to this topic
5 replies to this topic

#1 blueshogun96   Crossbones+   -  Reputation: 1090

Like
0Likes
Like

Posted 04 July 2014 - 04:52 PM

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.

Follow Shogun3D on the official website: http://shogun3d.net

 

blogger.png twitter.png tumblr_32.png facebook.png

 

"Yo mama so fat, she can't be frustum culled." - yoshi_lol


Sponsor:

#2 Nypyren   Crossbones+   -  Reputation: 4796

Like
0Likes
Like

Posted 04 July 2014 - 06:00 PM

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, 04 July 2014 - 06:09 PM.


#3 blueshogun96   Crossbones+   -  Reputation: 1090

Like
0Likes
Like

Posted 04 July 2014 - 06:03 PM

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


Follow Shogun3D on the official website: http://shogun3d.net

 

blogger.png twitter.png tumblr_32.png facebook.png

 

"Yo mama so fat, she can't be frustum culled." - yoshi_lol


#4 KnolanCross   Members   -  Reputation: 1361

Like
0Likes
Like

Posted 04 July 2014 - 06:20 PM

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.

Currently working on a scene editor for ORX (http://orx-project.org), using kivy (http://kivy.org).


#5 Nypyren   Crossbones+   -  Reputation: 4796

Like
0Likes
Like

Posted 04 July 2014 - 06:22 PM

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.

#6 blueshogun96   Crossbones+   -  Reputation: 1090

Like
0Likes
Like

Posted 04 July 2014 - 07:51 PM

^ 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.


Follow Shogun3D on the official website: http://shogun3d.net

 

blogger.png twitter.png tumblr_32.png facebook.png

 

"Yo mama so fat, she can't be frustum culled." - yoshi_lol






PARTNERS