|
|
|
@ -5,16 +5,16 @@
|
|
|
|
|
# @params
|
|
|
|
|
# Globals
|
|
|
|
|
# ${mydir}: current directory of the script, used for imports
|
|
|
|
|
# ${action_type}: what type of git commands to use, branch, commit files, modified files
|
|
|
|
|
# ${action_type}: what type of git commands to use (branch|select|commit|modified)
|
|
|
|
|
# ${selected_branch}: selected_branch to switch
|
|
|
|
|
# ${selected_files}: selected_files to checkout to the version in HEAD
|
|
|
|
|
# ${selected_files}: selected_files to checkout
|
|
|
|
|
# ${selected_commit}: selected commit to checkout
|
|
|
|
|
# ${confirm}: confirm status of the user
|
|
|
|
|
# Arguments
|
|
|
|
|
# -h: show help message
|
|
|
|
|
# -a: search all files instead of just the modified files
|
|
|
|
|
# -b: search branch and checkout branch
|
|
|
|
|
# -c: search commit and checkout commit
|
|
|
|
|
# -h|--help: show help message
|
|
|
|
|
# -s|--select: search all files instead of just the modified files
|
|
|
|
|
# -b|--branch: search branch and checkout branch
|
|
|
|
|
# -c|--commit: search commit and checkout commit
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
set -f
|
|
|
|
@ -25,14 +25,17 @@ source "${mydir}"/../helper/get_confirmation.sh
|
|
|
|
|
source "${mydir}"/../helper/git_query.sh
|
|
|
|
|
|
|
|
|
|
function usage() {
|
|
|
|
|
echo -e "Usage: dotbare fcheckout [-h] [-a] [-b] [-c] ...\n"
|
|
|
|
|
echo -e "Checkout files/commit/branch using fzf\n"
|
|
|
|
|
echo -e "Usage: dotbare fcheckout [-h] [-s] [-b] [-c] ...\n"
|
|
|
|
|
echo -e "Checkout files/commit/branch using fzf"
|
|
|
|
|
echo -e "files: checkout the version in HEAD or in a specific commit (reset files content back to the selected commit)"
|
|
|
|
|
echo -e "branch: switch to the selected branch"
|
|
|
|
|
echo -e "commit: switch to a specific commit\n"
|
|
|
|
|
echo -e "Default: checkout files back to HEAD (Reset changes back to HEAD)\n"
|
|
|
|
|
echo -e "optional arguments:"
|
|
|
|
|
echo -e " -h\t\tshow this help message and exit"
|
|
|
|
|
echo -e " -a\t\tsearch all files and select a commit to checkout for selected files"
|
|
|
|
|
echo -e " -b\t\tlist all branch and checkout/switch the selected branch"
|
|
|
|
|
echo -e " -c\t\tlist all commits and checkout selected commit"
|
|
|
|
|
echo -e " -h, --help\t\tshow this help message and exit"
|
|
|
|
|
echo -e " -s, --select\t\tsearch all files and select a commit to checkout for selected files"
|
|
|
|
|
echo -e " -b, --branch\t\tlist all branch and checkout/switch the selected branch"
|
|
|
|
|
echo -e " -c, --commit\t\tlist all commits and checkout selected commit"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
action_type="modified"
|
|
|
|
|