The Git/GitHub Questions, Answers and Howto Thread

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Message
Author
User avatar
adrian_broher
Programmer
Posts: 1072
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: The Git/GitHub Questions, Answers and Howto Thread

#121 Post by adrian_broher » Wed Jul 22, 2015 9:49 am

Dilvish wrote:@adrian_broher -- the one area where I at least nominally differ from your process is the step that (to the best of my recollection) was something like "hard reset master to feature". I generally just cherry pick the commits from feature to master, which is just a couple clicks and a few seconds in SmartGit. There is also one of its rebasing functions that could be used in this situation, but I never use that one. It seems to me like the end result is likely to be the same (at least in this situation that we're discussing) as your hard reset step, but am I overlooking something?
Context: viewtopic.php?p=76662#p76662

From the explanation the output is probably the same. The difference is the number of steps involved. As you already said:
which is just a couple clicks and a few seconds in SmartGit
and a hard reset is just one command for me instead of retyping multiple commands or writing a more complex bash loop.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12248
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: The Git/GitHub Questions, Answers and Howto Thread

#122 Post by Geoff the Medio » Sun Dec 20, 2015 11:47 am

For some reason, git has moved a bunch of commits from a branch to master when I pushed after attempting to rebase the branch on master, and this is all now on github. I committed and pushed a cleanup patch that, as far as I know, undoes the changes, but if someone who knows what they're doing wants to reset things (to this commit) to remove those extra commits from the history, perhaps that should be done?

User avatar
Vezzra
Release Manager, Design
Posts: 4609
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: The Git/GitHub Questions, Answers and Howto Thread

#123 Post by Vezzra » Sun Dec 20, 2015 5:43 pm

Geoff the Medio wrote:if someone who knows what they're doing wants to reset things (to this commit) to remove those extra commits from the history, perhaps that should be done?
Done. I'm also going to post a warning on this forum that I did a hard reset of master.

User avatar
Cjkjvfnby
AI Contributor
Posts: 448
Joined: Tue Jun 24, 2014 9:55 pm

Re: The Git/GitHub Questions, Answers and Howto Thread

#124 Post by Cjkjvfnby » Tue Dec 22, 2015 9:04 pm

Geoff the Medio wrote:For some reason, git has moved a bunch of commits from a branch to master when I pushed after attempting to rebase the branch on master, and this is all now on github. I committed and pushed a cleanup patch that, as far as I know, undoes the changes, but if someone who knows what they're doing wants to reset things (to this commit) to remove those extra commits from the history, perhaps that should be done?
You can work via PR as others. Githib has option to prevent direct push to master.
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12248
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: The Git/GitHub Questions, Answers and Howto Thread

#125 Post by Geoff the Medio » Tue Dec 22, 2015 9:31 pm

Cjkjvfnby wrote:You can work via PR as others.
This happened when I used a branch (which will eventually be merged by a pull request).

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: The Git/GitHub Questions, Answers and Howto Thread

#126 Post by MatGB » Wed Dec 23, 2015 11:33 am

If the branch is set up to track master (which it probably is), then when you push it it'll push to master unless you explicitly state you want it to go to a branch on your fork or to create a new branch on either your fork or on master.

I've told my git settings that, for example, github/freeorion is master, you're just geoff, I'm matgb, etc. If I want to push to a new branch I command git push matgb <newbranchname>, there are other more complex commands including : stuff to create branches on a non tracked master, etc.

(I have to use command line for a lot of stuff as I switch between Linux and Windows and I haven't found a GUI that duplicates itself similarly, plus command line is normal for me from AS400 days)

I'm terrible for forgetting to checkout the right branch and cherry picking stuff in before pushing, fortunately I've only done that to master once, and it was something we wanted up soon anyway.
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
Cjkjvfnby
AI Contributor
Posts: 448
Joined: Tue Jun 24, 2014 9:55 pm

Re: GitHub migration procedure

#127 Post by Cjkjvfnby » Thu Dec 24, 2015 2:04 pm

Vezzra wrote:
Geoff the Medio wrote:What does having a tag mean if the branch containing the commit that was tagged is deleted...?
AFAIK deleting a branch in git just deletes the "branch marker" pointing to the latest commit of the branch. This doesn't change anything about the commit history. The tag won't be affected by deleting the branch, and still point to the same commit as before.
all commits that present in this branch only and located after tag will be lost after garbage collector execution
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: The Git/GitHub Questions, Answers and Howto Thread

#128 Post by MatGB » Wed Mar 30, 2016 4:21 pm

I am having major problems trying to copy one of Morlic's branches

Code: Select all

git remote add morlic https://github.com/Morlic-fo/freeorion
matgb@MatGB-Desktop:~/freeorion$ git remote
banduri
dbenage
dilvish
master
matgb
morlic
silentone
sloth
vezzra
vktor
matgb@MatGB-Desktop:~/freeorion$ git fetch morlic
error: unable to resolve reference refs/remotes/morlic/AI-Chokepoints: Permission denied
From https://github.com/Morlic-fo/freeorion
 ! [new branch]      AI-Chokepoints -> morlic/AI-Chokepoints  (unable to update local ref)
error: unable to resolve reference refs/remotes/morlic/AI-Fighters: Permission denied
 ! [new branch]      AI-Fighters -> morlic/AI-Fighters  (unable to update local ref)
error: unable to resolve reference refs/remotes/morlic/AI-ProductionRework: Permission denied
 ! [new branch]      AI-ProductionRework -> morlic/AI-ProductionRework  (unable to update local ref)
error: unable to resolve reference refs/remotes/morlic/AI-refactor-ColonisationAI: Permission denied
 ! [new branch]      AI-refactor-ColonisationAI -> morlic/AI-refactor-ColonisationAI  (unable to update local ref)
error: unable to resolve reference refs/remotes/morlic/AI-repair-logic: Permission denied
 ! [new branch]      AI-repair-logic -> morlic/AI-repair-logic  (unable to update local ref)
error: unable to resolve reference refs/remotes/morlic/master: Permission denied
 ! [new branch]      master     -> morlic/master  (unable to update local ref)
matgb@MatGB-Desktop:~/freeorion$ 
I've already deleted and re-added the remote, neither command line or my GUI are getting me anywhere, either there's a weird setting on the remote that I can't access it or I'm doing something weird, but the simple git fetch {name} works well for me with everyone else, I use it regularly.
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
adrian_broher
Programmer
Posts: 1072
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: The Git/GitHub Questions, Answers and Howto Thread

#129 Post by adrian_broher » Wed Mar 30, 2016 4:35 pm

MatGB wrote:I am having major problems trying to copy one of Morlic's branches

I've already deleted and re-added the remote, neither command line or my GUI are getting me anywhere, either there's a weird setting on the remote that I can't access it or I'm doing something weird, but the simple git fetch {name} works well for me with everyone else, I use it regularly.
Did you ran this fetch command with sudo once (don't do that)? Because the 'permission denied' usually indicates that you tried to write to a file you don't have permission to write to.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: The Git/GitHub Questions, Answers and Howto Thread

#130 Post by MatGB » Wed Mar 30, 2016 4:37 pm

Never intentionally used sudo with git, and definitely haven't this session.
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
adrian_broher
Programmer
Posts: 1072
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: The Git/GitHub Questions, Answers and Howto Thread

#131 Post by adrian_broher » Wed Mar 30, 2016 4:41 pm

MatGB wrote:Never intentionally used sudo with git, and definitely haven't this session.
Creating files as root and with root owner are persistent across sessions.

try:

Code: Select all

find . -uid 0
from within the reposository to check if there is some odd file ownership going on. If should list any files that are owned by root.
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: The Git/GitHub Questions, Answers and Howto Thread

#132 Post by MatGB » Wed Mar 30, 2016 5:06 pm

Note: it's Morlic's Github remote I'm having problems accessing, I'm having zero problems with my git files locally (and I'm also able to grab stuff from other forks I don't have write access to).

I've worked around it by creating a new fork at my repo and then using a PR from his fork to mine and checking that out, but it wasn't ideal, and as I suspect I'll need to grab stuff from Morlic again we do need to work out where the issue is.
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
Cjkjvfnby
AI Contributor
Posts: 448
Joined: Tue Jun 24, 2014 9:55 pm

Re: The Git/GitHub Questions, Answers and Howto Thread

#133 Post by Cjkjvfnby » Wed Mar 30, 2016 6:27 pm

MatGB wrote:I am having major problems trying to copy one of Morlic's branches

Code: Select all

git remote add morlic https://github.com/Morlic-fo/freeorion[/quote]

http://stackoverflow.com/a/15458951 ?
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: The Git/GitHub Questions, Answers and Howto Thread

#134 Post by MatGB » Thu Mar 31, 2016 12:35 am

That doesn't appear to have helped

Code: Select all

matgb@MatGB-Desktop:~/freeorion$ git gc --prune=now
Counting objects: 84292, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (28080/28080), done.
Writing objects: 100% (84292/84292), done.
Total 84292 (delta 60737), reused 77957 (delta 55504)
matgb@MatGB-Desktop:~/freeorion$ git remote prune morlic
matgb@MatGB-Desktop:~/freeorion$ git fetch morlic
remote: Counting objects: 343, done.
remote: Total 343 (delta 273), reused 273 (delta 273), pack-reused 70
Receiving objects: 100% (343/343), 168.99 KiB | 0 bytes/s, done.
Resolving deltas: 100% (282/282), completed with 52 local objects.
error: unable to resolve reference refs/remotes/morlic/AI-Chokepoints: Permission denied
From https://github.com/Morlic-fo/freeorion
 ! [new branch]      AI-Chokepoints -> morlic/AI-Chokepoints  (unable to update local ref)
error: unable to resolve reference refs/remotes/morlic/AI-Fighters: Permission denied
 ! [new branch]      AI-Fighters -> morlic/AI-Fighters  (unable to update local ref)
error: unable to resolve reference refs/remotes/morlic/AI-ProductionRework: Permission denied
 ! [new branch]      AI-ProductionRework -> morlic/AI-ProductionRework  (unable to update local ref)
error: unable to resolve reference refs/remotes/morlic/AI-refactor-ColonisationAI: Permission denied
 ! [new branch]      AI-refactor-ColonisationAI -> morlic/AI-refactor-ColonisationAI  (unable to update local ref)
error: unable to resolve reference refs/remotes/morlic/AI-repair-logic: Permission denied
 ! [new branch]      AI-repair-logic -> morlic/AI-repair-logic  (unable to update local ref)
error: unable to resolve reference refs/remotes/morlic/master: Permission denied
 ! [new branch]      master     -> morlic/master  (unable to update local ref)
matgb@MatGB-Desktop:~/freeorion$ 
however I had never encountered prune before and given the mess my local git has got into over the time we've been using it I probably should, so thanks for the pointer.
adrianbroher wrote:try:

Code:
find . -uid 0


from within the reposository to check if there is some odd file ownership going on. If should list any files that are owned by root.
Nope, that gave me no output at all.
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

User avatar
adrian_broher
Programmer
Posts: 1072
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: The Git/GitHub Questions, Answers and Howto Thread

#135 Post by adrian_broher » Thu Mar 31, 2016 8:31 am

MatGB wrote:error: unable to resolve reference refs/remotes/morlic/AI-Chokepoints: Permission denied
What does

Code: Select all

ls -al .git/refs/remotes/morlic/AI-Chokepoints
or

Code: Select all

ls -al .git/refs/remotes/morlic/
print out?
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

Post Reply