Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuration of checkout_branch branch command #307

Merged
merged 1 commit into from
May 16, 2023

Conversation

tapayne88
Copy link
Contributor

Check list

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation

Description

Love the project! I'm using it to replace some scripts I'd hand rolled doing roughly the same thing!

However, I was hoping to use checkout_branch to quickly swap between recent branches. To do this I'd like to pass --sort=-committerdate to the git branch command to sort them by most recent commit.

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change
  • Documentation change

Test environment

  • Shell
    • bash
    • zsh
    • fish
  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:

@@ -447,7 +447,7 @@ _forgit_checkout_branch() {
fi

local git_checkout cmd preview opts branch
cmd="git branch --color=always --all | LC_ALL=C sort -k1.1,1.1 -rs"
cmd="git branch --color=always ${FORGIT_CHECKOUT_BRANCH_BRANCH_GIT_OPTS:---all} | LC_ALL=C sort -k1.1,1.1 -rs"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move --all to the default value so it can be omitted if desired

Copy link
Collaborator

@cjappl cjappl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems super useful. I'll probably end up using that option as well!

Great idea. Will wait for a review from one of the other folks before merging

@carlfriedrich
Copy link
Collaborator

Thanks for your contribution @tapayne88. That sounds super useful indeed! I won't have time for a detailed check within the next two weeks, though, @cjappl.

@cjappl
Copy link
Collaborator

cjappl commented May 14, 2023 via email

@cjappl cjappl merged commit f73ae97 into wfxr:master May 16, 2023
@cjappl
Copy link
Collaborator

cjappl commented May 16, 2023

Great addition. Thanks for the contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants