POV-Ray : Newsgroups : povray.off-topic : Is my life easier yet? : Re: Is my life easier yet? Server Time
18 Oct 2021 16:47:42 EDT (-0400)
  Re: Is my life easier yet?  
From: Jim Henderson
Date: 4 Oct 2021 19:01:09
Message: <615b87b5$1@news.povray.org>
On Mon, 04 Oct 2021 17:27:33 -0400, Cousin Ricky wrote:

> On 2021-10-02 8:10 PM (-4), Cousin Ricky wrote:
>> [snip]
> 
> I figured out that you copy and paste the PAT into the password field
> when you push to GitHub.  And it's gotta be either a paste or a
> credentials manager, because I'm not going to type 40 characters from a
> piece of paper.
> 
> And this was where I learned that I know less about Git than I realized.
>  In fact, I'm beginning to suspect than a month and a half of trying to
> learn Git has been as effective as catching water in a sieve.
> 
> Following an online 3rd party tutorial (and it has to be 3rd party,
> because documentation sucks), I created a remote repo on GitHub, added a
> short description and a license, and gave the URL to Git-Cola.  But when
> I tried to push, I got this message:
> 
> ----------[BEGIN MESSAGE]----------
> "git push" returned exit status 1
> 
> Have you rebased/pulled lately?
> 
> Pushing to https://github.com/CousinRicky/POV-AndroidRobot To
> https://github.com/CousinRicky/POV-AndroidRobot
>  ! [rejected]        main -> main (non-fast-forward)
> error: failed to push some refs to
> 'https://github.com/CousinRicky/POV-AndroidRobot'
> 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. -----------[END MESSAGE]-----------
> 
> So I tried git pull:
> 
> ----------[BEGIN MESSAGE]----------
> "git pull" returned exit status 128
> 
> POST git-upload-pack (294 bytes)
> From https://github.com/CousinRicky/POV-AndroidRobot
>  * branch            main       -> FETCH_HEAD = [up to date]      main  
>      -> origin/main
> fatal: refusing to merge unrelated histories -----------[END
> MESSAGE]-----------
> 
> Everything about that second message is telling me that over a month and
> a half I've learned NOTHING about how Git works.  And the 'Note about
> fast-forwards' in 'git push --help'?  It might as well have been written
> in Arabic for all I could understand.
> 
> I was about to post to a local Facebook tech group asking for
> local-project-to-GitHub tutorials or a tutorial service, but you all
> know how that turned out.

It sounds like you probably need to do a rebase.  I don't know how to do 
that in git-cola, but basically a pull just pulls the changes from the 
remote repository.  A rebase "is the process of moving or combining a 
sequence of commits to a new base commit. Rebasing is most useful and 
easily visualized in the context of a feature branching workflow." (from 
https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase)

What I might be inclined to do (I work from the CLI) is:

 git stash
 git pull --rebase
 git stash pop

Stash puts your changes in a ... stash.  (I know, kinda useless self-
referential definition).  It sets them aside.  The pull --rebase does the 
rebase, basically making sure you have a clean copy of the upstream repo.  
The stash pop then re-applies the diffs that you stashed.

From there you should be able to do a commit.

Of course, if you're the only one committing to the repo, then it's 
unlikely that the remote repo is out of sync with your local copy.

It's been a while since I did anything serious with git myself, and this 
is going from memory, so it's possible I've not got it 100% correct.



-- 
"I learned long ago, never to wrestle with a pig. You get dirty, and 
besides, the pig likes it." - George Bernard Shaw


Post a reply to this message

Copyright 2003-2021 Persistence of Vision Raytracer Pty. Ltd.