Skip to content

Commit

Permalink
Use --force-with-lease instead of --force
Browse files Browse the repository at this point in the history
  • Loading branch information
roguh committed Oct 22, 2024
1 parent 0c3a88b commit 7a5cc30
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ else
fi

##### Check if in git repo
git rev-parse --git-dir
# git rev-parse --git-dir
if ! git rev-parse --git-dir > /dev/null 2>&1; then
echo fatal: not in a git repo >&2
exit 1
Expand Down Expand Up @@ -131,7 +131,8 @@ elif [ "$REMOTE_STATUS" = "Need to push" ]; then
elif [ "$REMOTE_STATUS" = "Diverged" ]; then
if [ "$FORCE" = "true" ]; then
verbose FORCE PUSHING
run git push --force
# Use --force-with-lease instead of plain --force
run git push --force-with-lease
else
verbose Not running any commands
log "$REMOTE_STATUS"
Expand Down

0 comments on commit 7a5cc30

Please sign in to comment.