Page 9 of 15

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

Posted: Wed Jul 22, 2015 9:49 am
by adrian_broher
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.

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

Posted: Sun Dec 20, 2015 11:47 am
by Geoff the Medio
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?

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

Posted: Sun Dec 20, 2015 5:43 pm
by Vezzra
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.

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

Posted: Tue Dec 22, 2015 9:04 pm
by Cjkjvfnby
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.

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

Posted: Tue Dec 22, 2015 9:31 pm
by Geoff the Medio
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).

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

Posted: Wed Dec 23, 2015 11:33 am
by MatGB
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.

Re: GitHub migration procedure

Posted: Thu Dec 24, 2015 2:04 pm
by Cjkjvfnby
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

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

Posted: Wed Mar 30, 2016 4:21 pm
by MatGB
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.

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

Posted: Wed Mar 30, 2016 4:35 pm
by adrian_broher
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.

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

Posted: Wed Mar 30, 2016 4:37 pm
by MatGB
Never intentionally used sudo with git, and definitely haven't this session.

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

Posted: Wed Mar 30, 2016 4:41 pm
by adrian_broher
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.

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

Posted: Wed Mar 30, 2016 5:06 pm
by MatGB
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.

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

Posted: Wed Mar 30, 2016 6:27 pm
by Cjkjvfnby
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 ?

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

Posted: Thu Mar 31, 2016 12:35 am
by MatGB
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.

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

Posted: Thu Mar 31, 2016 8:31 am
by adrian_broher
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?