mirror of
https://github.com/tomasriveral/Nix-Git-Cherry-Picker.git
synced 2026-08-12 02:38:38 +02:00
ngcp pick: pull before cherry-picking
This commit is contained in:
@@ -62,7 +62,19 @@ if [[ "$1" == "pick" ]]; then
|
|||||||
if ! git -C "$nixConfigPath" checkout "$remoteBranch"; then
|
if ! git -C "$nixConfigPath" checkout "$remoteBranch"; then
|
||||||
git -C "$nixConfigPath" checkout -b "$remoteBranch" "origin/$remoteBranch"
|
git -C "$nixConfigPath" checkout -b "$remoteBranch" "origin/$remoteBranch"
|
||||||
fi
|
fi
|
||||||
|
echo "Pulling latest commits before cherry-picking..."
|
||||||
|
if ! git -C "$nixConfigPath" pull --rebase ; then
|
||||||
|
echo "Merge conflict detected during pull."
|
||||||
|
echo "Resolve conflicts and run:"
|
||||||
|
echo " git rebase --continue"
|
||||||
|
echo "Type 'y' when done."
|
||||||
|
|
||||||
|
while git -C "$nixConfigPath" rev-parse --verify REBASE_HEAD >/dev/null 2>&1; do
|
||||||
|
read -r answer
|
||||||
|
[[ "$answer" == "y" ]] || continue
|
||||||
|
done
|
||||||
|
echo "Pull successful"
|
||||||
|
fi
|
||||||
for commit in "${@:2}"; do
|
for commit in "${@:2}"; do
|
||||||
if ! [[ $commit =~ --.* ]]; then # if not a flag
|
if ! [[ $commit =~ --.* ]]; then # if not a flag
|
||||||
if git -C "$nixConfigPath" cherry-pick "$commit"; then
|
if git -C "$nixConfigPath" cherry-pick "$commit"; then
|
||||||
|
|||||||
Reference in New Issue
Block a user