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

Manage and checkout branches #91

Closed
alistaircarscadden opened this issue May 27, 2020 · 9 comments
Closed

Manage and checkout branches #91

alistaircarscadden opened this issue May 27, 2020 · 9 comments
Labels
enhancement New feature or request
Milestone

Comments

@alistaircarscadden
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I would like to be able to do functionality such as:

git checkout -b newbranch
git branch -d oldbranch

Describe the solution you'd like
Functionality similar to commit in the Status menu, that would perform these functions.

@extrawurst
Copy link
Owner

Hi @alistaircarscadden I was thinking about this before, I don't know a good place to put it in right now. In what tab would you expect this functionality?

@extrawurst extrawurst added the enhancement New feature or request label May 27, 2020
@alistaircarscadden
Copy link
Contributor Author

alistaircarscadden commented May 27, 2020

Here's my brainstorming. Obviously there's a lot of room for improvement with my design!

Perhaps from Status you'd press B and be taken to another page that isn't quite a tab. I'd imagine doing something like (from Status)

Branch [b]

Would initially show

 Status   |   Log   |
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
┌Branch────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|   dev       7a9684a add: new stuff
|   dev_0.0.2 eccf7b4 clean up some stuff
|   dev_27    efe89c0 Merge branch 'master' of https://github.com/stuff/stuff into dev_27
| * dev_41    50be3ac add: good ideas and stuff
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Switch branches [b] Create new branch [c] Rename branch [m] Set upstream [u] Detach from [d] Merge branch [m]

The contents would be generated similar to git branch --list --verbose --verbose (two verboses prints the upstream branches).

Some popups would look like:

┌Upstream branch───────────────────────────────────────────────────────┐
│type branch name..                                                    │
└──────────────────────────────────────────────────────────────────────┘
Set upstream branch [Enter] Remove usptream branch [Backspace] Close [esc]

Which would perform git branch <local_branch> --set-upstream-to=<remote_branch>

┌New branch─────────────────────────────────From───────────────────────┐
│type branch name..                        |(optional)                 │
└──────────────────────────────────────────────────────────────────────┘
Create new branch [Enter] Create new branch and checkout [Shift+Enter] Close [esc]

Which would perform git branch <new_branch> and git branch <new_branch> <old_branch> and git checkout -b <new_branch_to_checkout_to>.

┌Rename branch──────────────────────────────From───────────────────────┐
│type branch name..                        |(optional)                 │
└──────────────────────────────────────────────────────────────────────┘
Rename branch [Enter] Close [esc]

Which would perform git branch -m <oldname> <newname>.

Lots of these commands often give warnings, for example if a branch is not fully merged and you do git branch -d <xyz> it would tell you that you can't unless you use -D instead of -d.

┌Warning───────────────────────────────────────────────────────────────┐
| xyzbranch already exists (or xyzbranch is not fully merged) force this command?
└──────────────────────────────────────────────────────────────────────┘
Yes [Enter] No [esc]

No stops the op and Yes would promote d to D.

@alistaircarscadden
Copy link
Contributor Author

My design above probably lacks some intuition because I wasn't thinking the user would be selecting a branch the same way they select a commit in the Log tab. That would probably be a good functionality.

Perhaps instead of Switch branches [b] Create new branch [c] it could just be Go to [b] which would perform both functions depending on where your cursor was in the list of branches. At the bottom, after all the branch names, we could have New branch... where the user would then be creating one instead of checking one out.

In the New branch menu from above, the From side could be autofilled to whatever the user was hovering on before entering, same as the behaviour in git CLI. Same as Rename branch.

@extrawurst
Copy link
Owner

@alistaircarscadden thanks for coming up with such a detailed design, I think this might be worth looking into as a popup accessible from the Status and Log tab 🤔
Anyhow there are quite some steps to take beforehand:

  • support for more commands ([RFC] more commands support #83)
  • we currently do not support the default features ssh and https of our dependency git2-rs which is required to use the networking features for upstream branches
  • checking out the braching features of git2-rs to see if all the functionality is there.

Plus I think this issue smells too big for a single feature. Ideally we would break it into smaller chunks and start with a simple MVP that only allows switching branches locally maybe?

@hasufell
Copy link

IMO it should be its own tab and show references, not just branches (git show-ref). References can be a lot.

In addition, branches should also be visible in the log view. Currently I only see tags there.

@hasufell
Copy link

It seems this ticket was accidentally closed?

@extrawurst
Copy link
Owner

Nope it's implemented on master

@hasufell
Copy link

I just built from master, there's still no reference/branch view afais?

@extrawurst
Copy link
Owner

@hasufell see the changelog, please feel free to raise a new issue if you see anything broken that is supposed to work or anything particular missing

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

No branches or pull requests

3 participants