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

docs: example of using config vars to sort git branch #319

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think there's a typo here. Shouldn't it be

FORGIT_CHECKOUT_BRANCH_GIT_OPTS

instead of

FORGIT_CHECKOUT_BRANCH_BRANCH_GIT_OPTS

?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think there's a typo here. Shouldn't it be

FORGIT_CHECKOUT_BRANCH_GIT_OPTS

instead of

FORGIT_CHECKOUT_BRANCH_BRANCH_GIT_OPTS

?

Both exist, see

cmd="git branch --color=always ${FORGIT_CHECKOUT_BRANCH_BRANCH_GIT_OPTS:---all} | LC_ALL=C sort -k1.1,1.1 -rs"

FORGIT_CHECKOUT_BRANCH_BRANCH_GIT_OPTS is passed the command that retrieves the branches, FORGIT_CHECKOUT_BRANCH_GIT_OPTS is passed to the git checkout command.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@sandr01d Ah, thanks for clarifying, and sorry for the noise! 🙈

Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ For linux users `FORGIT_COPY_CMD` should be set to make copy work. Example: `FOR
Options can be set via environment variables. They have to be **exported** in
order to be recognized by `forgit`.

For instance, if you want to order branches in `gcb` by the last committed date you could:

```shell
export FORGIT_CHECKOUT_BRANCH_BRANCH_GIT_OPTS='--sort=-committerdate'
```

#### shell aliases

You can change the default aliases by defining these variables below.
Expand Down