files-community / Files

Building the best file manager for Windows
https://files.community
MIT License
33.7k stars 2.15k forks source link

Feature: Git integration #11014

Closed yaira2 closed 1 year ago

yaira2 commented 1 year ago

What feature or improvement do you think would benefit Files?

Integration with git is something that may add value for developers. We're inviting the open-source community to share feedback on which git features they would find useful in a file manager and how it would enhance their workflow. Design concepts are welcome as well.

Requirements

Phase 1 (implemented)

Phase 2 (implemented)

Phase 3 (implemented)

Phase 4 (implemented)

Future planning

Files Version

v2.4.21

Windows Version

Windows 11

Comments

No response

yaira2 commented 1 year ago

Fyi @onein528

yaira2 commented 1 year ago

I think the bare minimum would be support for switching branches. This can be achieved by adding a button/flyout to the status bar.

0x5bfa commented 1 year ago

You mean if you open the repository in Files, you will be able to perform Git operations, such as change branch, commit, push, sync?

Here's my thought

Minimum

Could

yaira2 commented 1 year ago

Push uncommitted changes

This requires UI for a commit message, not impossible but would require a lot of thought.

Git commit tree viewing in preview pane or something

A possibility but curious how it would fit into users workflow and how the UI could be integrated.

Pull Sync

I might add these to the minimum

0x5bfa commented 1 year ago

I'll look what I can do and try to find what can be implemented.

Josh65-2201 commented 1 year ago

Could show the changes of a file in the preview pane when selected. If it isn't too much having a separate "changes" pane to show them all would properly be good too. Ideally it would look like GitHub with the addition and removals of each line.

hecksmosis commented 1 year ago

This would be very useful

hecksmosis commented 1 year ago

We should probably enable/disable this in settings to not clog the app for non-devs

Josh65-2201 commented 1 year ago

Properly wont need a setting since outside of a directory with a GitHub link it shouldn't be shown

0x5bfa commented 1 year ago

image

yaira2 commented 1 year ago

Is it possible to use the one already installed on the system?

yaira2 commented 1 year ago

@onein528 instead of branch:, maybe we can show an icon instead (similar to Visual Studio).

0x5bfa commented 1 year ago

Files source code is very hard to understand... I couldn't implement.

FYI

Requirements:

ferrariofilippo commented 1 year ago

I'm currently working on this feature. There are a couple of things we need to decide before I can continue my work.

Checkout Menu

User's Credentials

yaira2 commented 1 year ago

Checkout Menu

Phase 1 shouldn't have a checkout menu, I think we should wait for feedback on phase 1 before making these decisions.

ferrariofilippo commented 1 year ago

So phase 1 will be:

0x5bfa commented 1 year ago

Credentials of committer

There’s no need to be authorized by GitHub. We have to show a modal to prompt a user to enter username/password. And commit and push by using libgit2sharp.

https://stackoverflow.com/questions/25084890/how-to-commit-and-push-in-libgit2sharp

Checkout Menu

How do you access the checkout menu? Should we use a separate button? I think that clicking on the branch name should open the menu (like in VS)?

Should be like VS.

What kind of menu should we use? A flyout or a modal?

flyout. If we are going to implement branch management, should be a modal in managing such as deleting, renaming, checking out, cherry picking.

What actions should be there? I was thinking of choosing the branch and creating a new one (what about inlcuding delete and rename?)

On hovering, show delete glyph and rename glyph. Yes, on the top of the flyout, show textbox for creating a new branch.

User's Credentials

Should we prompt users each time they try to push or pull? Should we save a token (GitHub Desktop, FluentHub) so that they don't need to log in each time?

One time, first time only(not first launch though).

If we choose the token option, how should we handle it? I think we might prompt users if they aren't logged in. We should also include a section in settings to allow them to log in and log out

I mistakenly understood that we have to implement authorization steps. But not.

ferrariofilippo commented 1 year ago

Phase 1 shouldn't have a checkout menu, I think we should wait for feedback on phase 1 before making these decisions.

Since I've already written some of the code related to phase 2, should I comment that out in the PR? (Which means hiding push/pull/sync buttons and commenting out ExecuteAsync() bodies of these actions)

yaira2 commented 1 year ago

I updated the requirements for phase 2.

ferrariofilippo commented 1 year ago

How should we differentiate the active branch in the menu? Should we put it on top? Should it be bold?

yaira2 commented 1 year ago

The ListView control has a selected state that would work for this.

ferrariofilippo commented 1 year ago

What do you think @yaira2? I still need to handle uncommited changes, but the basic checkout works! image

yaira2 commented 1 year ago

Looks amazing! Can you add a fixed height and width to the flyout (200 x 200 is probably good)?

0x5bfa commented 1 year ago

Amazing! Can you customize Flyout padding?

+--------------------+
| Branches           |
| +----------------+ |
| | pr-202         | |
| +----------------+ |
| +----------------+ |
| | hotfix         | |
| +----------------+ |
|  ...               |
+--------------------+

Branches label is styled strong text block style.

ferrariofilippo commented 1 year ago

Like this? image

yaira2 commented 1 year ago

I updated the requirements for phase 3.

ferrariofilippo commented 1 year ago

Support for creating new branches, the button is already implemented in the UI. Clicking the new branch button should open a content dialog that allows the user to enter the branch name.

I'll start to work on this part of the feature @yaira2 should the user be able to choose the base branch for the new one?

0x5bfa commented 1 year ago

(what's the best way to display the list of changes?)

I highly recommend to use Preview Pane.

yaira2 commented 1 year ago

should the user be able to choose the base branch for the new one?

Yes

hez2010 commented 1 year ago

I'm wondering if we can implement the support for viewing the contents of a branch without actually checking out it. I always want to check the diff between two branches or copy a file from one branch to another, but git itself doesn't support it so I always end up duplicating the whole project directory and checking out them to different branches.

0x5bfa commented 1 year ago

When we need to implement GitHub-like feature, we can use GitHub APIs such as 'compare'. https://stackoverflow.com/questions/64202547/how-to-compare-two-branches-in-github-with-graphql

yaira2 commented 1 year ago

I'm wondering if we can implement the support for viewing the contents of a branch without actually checking out it. I always want to check the diff between two branches or copy a file from one branch to another, but git itself doesn't support it so I always end up duplicating the whole project directory and checking out them to different branches.

I can see this being useful in multipane mode, the files would have to be read only as well but this is something we can look into once we finish with the fundamentals.

yaira2 commented 1 year ago

Phase 4 is ready to build, this is also the final stage before we are ready to release the changes to stable.

ferrariofilippo commented 1 year ago

What about deleting local branches?

yaira2 commented 1 year ago

What about deleting local branches?

That could be one of the actions we display in #12440