-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Draft: Add support for automatic branch tracking #54
base: master
Are you sure you want to change the base?
Draft: Add support for automatic branch tracking #54
Conversation
3604378
to
b7d2890
Compare
Not working for some already existing branches (like "master").
Some thoughts:
|
@@ -66,6 +66,7 @@ function! fzf_checkout#execute(type, action, lines) abort | |||
let l:branch = trim(shellescape(split(a:lines[2])[0]), l:trimchars) | |||
endif | |||
endif | |||
let l:branchlo = substitute(l:branch, '^origin/', '', 'g') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, this is one of the "lazy" implementation I came a long time ago, but obviously you can have other names for the remote, and branches and remotes can also have /
in the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the name origin
, you are absolutely right, it was just a first draft, to be corrected.
For the slash being possibly part of the branch name, I thought about that, but did not know that the origin name could also contain one...
I may have a solution, but we will not be able to distinguish between first/second/last
, with first/second
being the remote and last
the branch name, against first
the remote name and second/last
being the branch name.
I hope that no sane developer would use this kind of logic to organize branches and remotes...
I think if we find a way to make this work for all cases that option could be deprecated, or maybe just leave it around.
I like the idea, maybe accept a list of commands instead of just one, so they are retried one after one.
Yeah, having this in bash is more easy, but introduces problems with compatibility with mac/windows and even with the shell being used, that's why I'm trying to have more this on vimscript when possible. |
Good remarks and arguments. Thanks for the feedback! |
This is a draft related to the issue #50. Only to have a tracked discussion on how to implement this feature.
The idea is to try first to create a new branch with remote tracking; if the branch already exists, it will fail and trigger the second command doing a normal
git checkout
.I'm using this in a bash script to do fzf branch managment ( 😄 ) since years and it works fine.