Reputation: 1716
I created a git subtree by following the instructions here - https://help.github.com/articles/working-with-subtree-merge
Perhaps unfortunely, I did a normal TortoiseGit push on the repository that contained the subtree. For some reason, a changed file from the subtree was listed in TortoiseGit's changelist (it was legitimately changed, btw), so I thought "Oh! Neat! TortoiseGit automatically supports subtree!", so I went ahead and committed and did a normal TortoiseGit push.
Then to test that TortoiseGit did what I thought, I got a clone of the repository where the subtree was located, and pulled. Sadly, I did not get the change from the subtree the I thought I pushed in TortoiseGit...
So now I wasn't sure what happened, so I resorted to installing git-subtree and trying different variations of the push command on the subtree until something seemed to work -
git subtree push --prefix=prime origin/prime prime/master
git subtree push --prefix=prime prime prime/master
git subtree push --prefix=prime/ -u prime/master
git subtree push --prefix=prime/ prime/master
git subtree push --prefix=prime/ prime prime/master
git subtree push --prefix=prime/ https://github.com/bryanedds/prime.git prime/master
git subtree push --prefix=prime/ https://github.com/bryanedds/prime.git master
I should have known better than to just guess, as I presume one of these lines accidentally pushed a new branch or something, and now maybe is causing the problems pertinent to this question...
Still, I carried on, trying to just follow instructions I found elsewhere on the net to make sure I did things okay -
git subtree pull -P prime https://github.com/bryanedds/prime.git master
Which seemed to work. But still not sure I pushed correctly, I tried pushing again according to the new page I found - git subtree push -P prime https://github.com/bryanedds/prime.git master
and it gives me all kinds of crazy output with a rejection error -
git push using: https://github.com/bryanedds/prime.git master
1/ 287 (0)2/ 287 (1)3/ 287 (2)4/ 287 (3)5/ 287 (4)6/ 287 (5)7/
287 (6)8/ 287 (7)9/ 287 (8)10/ 287 (9)11/ 287 (10)12/ 287 (11
)13/ 287 (12)14/ 287 (13)15/ 287 (14)16/ 287 (15)17/ 287 (16)18/
287 (17)19/ 287 (18)20/ 287 (19)21/ 287 (20)22/ 287 (21)23/ 28
7 (22)24/ 287 (23)25/ 287 (24)26/ 287 (25)27/ 287 (26)28/ 287 (27
)29/ 287 (28)30/ 287 (29)31/ 287 (30)32/ 287 (31)33/ 287 (32)34/
287 (33)35/ 287 (34)36/ 287 (35)37/ 287 (36)38/ 287 (37)39/ 28
7 (38)40/ 287 (39)41/ 287 (40)42/ 287 (41)43/ 287 (42)44/ 287 (43
)45/ 287 (44)46/ 287 (45)47/ 287 (46)48/ 287 (47)49/ 287 (48)50/
287 (49)51/ 287 (50)52/ 287 (51)53/ 287 (52)54/ 287 (53)55/ 28
7 (54)56/ 287 (55)57/ 287 (56)58/ 287 (57)59/ 287 (58)60/ 287 (59
)61/ 287 (60)62/ 287 (61)63/ 287 (62)64/ 287 (63)65/ 287 (64)66/
287 (65)67/ 287 (66)68/ 287 (67)69/ 287 (68)70/ 287 (69)71/ 28
7 (70)72/ 287 (71)73/ 287 (72)74/ 287 (73)75/ 287 (74)76/ 287 (75
)77/ 287 (76)78/ 287 (77)79/ 287 (78)80/ 287 (79)81/ 287 (80)82/
287 (81)83/ 287 (82)84/ 287 (83)85/ 287 (84)86/ 287 (85)87/ 28
7 (86)88/ 287 (87)89/ 287 (88)90/ 287 (89)91/ 287 (90)92/ 287 (91
)93/ 287 (92)94/ 287 (93)95/ 287 (94)96/ 287 (95)97/ 287 (96)98/
287 (97)99/ 287 (98)100/ 287 (99)101/ 287 (100)102/ 287 (101)103/
287 (102)104/ 287 (103)105/ 287 (104)106/ 287 (105)107/ 287 (106
)108/ 287 (107)109/ 287 (108)110/ 287 (109)111/ 287 (110)112/ 287
(111)113/ 287 (112)114/ 287 (113)115/ 287 (114)116/ 287 (115)117/
287 (116)118/ 287 (117)119/ 287 (118)120/ 287 (119)121/ 287 (120)1
22/ 287 (121)123/ 287 (122)124/ 287 (123)125/ 287 (124)126/ 287 (
125)127/ 287 (126)128/ 287 (127)129/ 287 (128)130/ 287 (129)131/
287 (130)132/ 287 (131)133/ 287 (132)134/ 287 (133)135/ 287 (134)136
/ 287 (135)137/ 287 (136)138/ 287 (137)139/ 287 (138)140/ 287 (13
9)141/ 287 (140)142/ 287 (141)143/ 287 (142)144/ 287 (143)145/ 28
7 (144)146/ 287 (145)147/ 287 (146)148/ 287 (147)149/ 287 (148)150/
287 (149)151/ 287 (150)152/ 287 (151)153/ 287 (152)154/ 287 (153)
155/ 287 (154)156/ 287 (155)157/ 287 (156)158/ 287 (157)159/ 287
(158)160/ 287 (159)161/ 287 (160)162/ 287 (161)163/ 287 (162)164/
287 (163)165/ 287 (164)166/ 287 (165)167/ 287 (166)168/ 287 (167)16
9/ 287 (168)170/ 287 (169)171/ 287 (170)172/ 287 (171)173/ 287 (1
72)174/ 287 (173)175/ 287 (174)176/ 287 (175)177/ 287 (176)178/ 2
87 (177)179/ 287 (178)180/ 287 (179)181/ 287 (180)182/ 287 (181)183/
287 (182)184/ 287 (183)185/ 287 (184)186/ 287 (185)187/ 287 (186
)188/ 287 (187)189/ 287 (188)190/ 287 (189)191/ 287 (190)192/ 287
(191)193/ 287 (192)194/ 287 (193)195/ 287 (194)196/ 287 (195)197/
287 (196)198/ 287 (197)199/ 287 (198)200/ 287 (199)201/ 287 (200)2
02/ 287 (201)203/ 287 (202)204/ 287 (203)205/ 287 (204)206/ 287 (
205)207/ 287 (206)208/ 287 (207)209/ 287 (208)210/ 287 (209)211/
287 (210)212/ 287 (211)213/ 287 (212)214/ 287 (213)215/ 287 (214)216
/ 287 (215)217/ 287 (216)218/ 287 (217)219/ 287 (218)220/ 287 (21
9)221/ 287 (220)222/ 287 (221)223/ 287 (222)224/ 287 (223)225/ 28
7 (224)226/ 287 (225)227/ 287 (226)228/ 287 (227)229/ 287 (228)230/
287 (229)231/ 287 (230)232/ 287 (231)233/ 287 (232)234/ 287 (233)
235/ 287 (234)236/ 287 (235)237/ 287 (236)238/ 287 (237)239/ 287
(238)240/ 287 (239)241/ 287 (240)242/ 287 (241)243/ 287 (242)244/
287 (243)245/ 287 (244)246/ 287 (245)247/ 287 (246)248/ 287 (247)24
9/ 287 (248)250/ 287 (249)251/ 287 (250)252/ 287 (251)253/ 287 (2
52)254/ 287 (253)255/ 287 (254)256/ 287 (255)257/ 287 (256)258/ 2
87 (257)259/ 287 (258)260/ 287 (259)261/ 287 (260)262/ 287 (261)263/
287 (262)264/ 287 (263)265/ 287 (264)266/ 287 (265)267/ 287 (266
)268/ 287 (267)269/ 287 (268)270/ 287 (269)271/ 287 (270)272/ 287
(271)273/ 287 (272)274/ 287 (273)275/ 287 (274)276/ 287 (275)277/
287 (276)278/ 287 (277)279/ 287 (278)280/ 287 (279)281/ 287 (280)2
82/ 287 (281)283/ 287 (282)284/ 287 (283)285/ 287 (284)286/ 287 (
285)287/ 287 (286)Username for 'https://github.com': bryanedds
Password for 'https://[email protected]':
To https://github.com/bryanedds/prime.git
! [rejected] f9376cdb70e9217ff005abedb3009e3db293f5dc -> master (non-fas
t-forward)
error: failed to push some refs to 'https://github.com/bryanedds/prime.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
I tried pulling again, but to no avail. Also, importantly, what is with all the numbers, parens, and slashes??? I'm totally stuck and lost now, and it's probably my fault for bumbling around, so I would sincerely appreciate help on this matter!
Lastly, I may have done other bad things while digging myself into this hole... I wish I had a log of what all I did, but CMD doesn't think anyone will ever need to know more than the last 50 lines of their session........ >:(
Upvotes: 2
Views: 1355
Reputation: 141
I had the same issue when trying to push changes I made in a subtree. I did all of the setup using git bash but got the same type of output when trying to push the subtree to my remote.
The solution was to update git to the newest version a https://git-scm.com/downloads.
After that the following command that used to fail now worked:
git subtree push --prefix=DIR_PATH REMOTE_NAME master
Upvotes: 0
Reputation: 303
The link you gave is about the subtree merge, which is not to be confused with the git subtree
command, which is part of a git extension.
If you do a git branch
and you can see a local prime
branch apart from your master
branch of your parent project, then you can do a
git subtree split --prefix=prime --onto prime --branch prime
And then push to your prime
repository with
git push -f prime prime:master
If you do not see the prime
branch locally, then you can do a new split with git subtree
by doing a
git subtree split --prefix=prime --branch prime
It will create a new hanging branch called prime
that can keep track of your remote prime
repository. To update your prime
remote repository, you can either do
git push -f prime prime:master
Upvotes: 4