Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Computer Resources
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IMGW
Computer Resources
Commits
3e998a89
Commit
3e998a89
authored
4 years ago
by
Michael Blaschek
Browse files
Options
Downloads
Patches
Plain Diff
push choice
parent
f257f49b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Git/git-repos-sync
+22
-12
22 additions, 12 deletions
Git/git-repos-sync
with
22 additions
and
12 deletions
Git/git-repos-sync
100644 → 100755
+
22
−
12
View file @
3e998a89
...
@@ -38,7 +38,7 @@ fi
...
@@ -38,7 +38,7 @@ fi
if
git checkout
--quiet
-b
sync-
$3
right/
$3
;
then
if
git checkout
--quiet
-b
sync-
$3
right/
$3
;
then
echo
"Merge branches from left and right if necessary."
echo
"Merge branches from left and right if necessary."
if
!
git merge
-m
"Merge to sync between
$1
and
$2
"
--log
left/
$3
;
then
if
!
git merge
-m
"Merge to sync between
$1
and
$2
"
--log
left/
$3
;
then
>
&2
echo
"Merge conflict. Solve i
s
manually, commit and rerun script."
>
&2
echo
"Merge conflict. Solve i
t
manually, commit and rerun script."
exit
1
exit
1
fi
fi
else
else
...
@@ -46,29 +46,39 @@ else
...
@@ -46,29 +46,39 @@ else
git checkout
--quiet
sync-
$3
git checkout
--quiet
sync-
$3
echo
"Try to merge with right first"
echo
"Try to merge with right first"
if
!
git merge
-m
"Merge to sync between
$1
and
$2
"
--log
right/
$3
;
then
if
!
git merge
-m
"Merge to sync between
$1
and
$2
"
--log
right/
$3
;
then
>
&2
echo
"Merge conflict. Solve i
s
manually, commit and rerun script."
>
&2
echo
"Merge conflict. Solve i
t
manually, commit and rerun script."
exit
1
exit
1
fi
fi
if
!
git merge
-m
"Merge to sync between
$1
and
$2
"
--log
left/
$3
;
then
if
!
git merge
-m
"Merge to sync between
$1
and
$2
"
--log
left/
$3
;
then
>
&2
echo
"Merge conflict. Solve i
s
manually, commit and rerun script."
>
&2
echo
"Merge conflict. Solve i
t
manually, commit and rerun script."
exit
1
exit
1
fi
fi
fi
fi
echo
"Push merged changes in
$3
to
$2
"
echo
"Push merged changes in
$3
to
$2
"
if
!
git push
$2
HEAD:
$3
;
then
read
-p
"[USER] continue (y/n)"
REPLY
>
&2
echo
"Fatal: unable to push to
$2
, rerun the script as soon as connection restored."
# echo "REPLY: $REPLY"
exit
1
if
[
"
$REPLY
"
==
"y"
]
;
then
if
!
git push
$2
HEAD:
$3
;
then
>
&2
echo
"Fatal: unable to push to
$2
, rerun the script as soon as connection restored."
exit
1
fi
else
echo
"Abort not pushed to
$2
"
fi
fi
echo
"Push merged changes in
$3
to
$1
"
if
!
git push
$1
HEAD:
$3
;
then
>
&2
echo
"Fatal: unable to push to
$1
, rerun the script as soon as connection restored."
exit
1
echo
"Push merged changes in
$3
to
$1
"
read
-p
"[USER] continue (y/n)"
REPLY
# echo "REPLY: $REPLY"
if
[
"
$REPLY
"
==
"y"
]
;
then
if
!
git push
$1
HEAD:
$3
;
then
>
&2
echo
"Fatal: unable to push to
$1
, rerun the script as soon as connection restored."
exit
1
fi
else
echo
"Abort not pushed to
$1
"
fi
fi
git checkout
--quiet
master
git checkout
--quiet
master
git branch
-D
--quiet
sync-
$3
git branch
-D
--quiet
sync-
$3
echo
"Done."
echo
"Done."
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment