Skip to content

Instantly share code, notes, and snippets.

@willywongi
Created November 27, 2024 16:13
Show Gist options
  • Save willywongi/52a71f70c1e39879fbc0a2eadf5b5a4c to your computer and use it in GitHub Desktop.
Save willywongi/52a71f70c1e39879fbc0a2eadf5b5a4c to your computer and use it in GitHub Desktop.
Fork (Git client) custom command
is_stash_needed=$(git status -s)
if [ -n "$is_stash_needed" ]
then
git stash push
fi
git checkout $1{ref}
git merge ${ref}
git push origin refs/heads/$1{ref}
git checkout ${ref}
if [ -n "$is_stash_needed" ]
then
git stash pop
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment