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

Feature: Git integration #11014

Closed
yaira2 opened this issue Jan 15, 2023 · 35 comments
Closed

Feature: Git integration #11014

yaira2 opened this issue Jan 15, 2023 · 35 comments

Comments

@yaira2
Copy link
Member

yaira2 commented Jan 15, 2023

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)

  • Display the branch name in the status bar, this will let the user know which branch is active.

Phase 2 (implemented)

  • Support for switching between local branches (this can be a simple flyout with a list view)
    • Display content dialog if there are uncommitted changes and ask user if they want to take the changes.
    • Display content dialog if there are uncommitted changes that can't be taken to the other branch and ask the user if they want to stash them.

Phase 3 (implemented)

  • Support for checking out remote branches.
  • 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.

Phase 4 (implemented)

  • Support for pulling remote changes
  • Indicate on the status bar when there are remote commits

Future planning

  • Indicate on the status bar when there are uncommitted changes
  • Support for committing and pushing changes (what's the best way to display the list of changes?)
  • Support for searching local branches

Files Version

v2.4.21

Windows Version

Windows 11

Comments

No response

@yaira2 yaira2 moved this from 🆕 New to 📋 Planning stage in Files task board Jan 15, 2023
@yaira2
Copy link
Member Author

yaira2 commented Jan 15, 2023

Fyi @onein528

@yaira2
Copy link
Member Author

yaira2 commented Jan 15, 2023

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
Copy link
Member

0x5bfa commented Jan 15, 2023

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

  • Switch Branch Functionality

Could

  • Push uncommitted changes
  • Pull
  • Sync
  • Git commit tree viewing in preview pane or something

@yaira2
Copy link
Member Author

yaira2 commented Jan 15, 2023

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
Copy link
Member

0x5bfa commented Jan 15, 2023

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

@Josh65-2201
Copy link
Member

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
Copy link
Contributor

This would be very useful

@hecksmosis
Copy link
Contributor

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

@Josh65-2201
Copy link
Member

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

@0x5bfa
Copy link
Member

0x5bfa commented Feb 4, 2023

image

@yaira2
Copy link
Member Author

yaira2 commented Feb 5, 2023

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

@yaira2
Copy link
Member Author

yaira2 commented Feb 5, 2023

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

@0x5bfa
Copy link
Member

0x5bfa commented Feb 12, 2023

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

FYI

Requirements:

  • Use C# Git lib named LibGit2Sharp.
  • Even if you open the repository subfolder, Files have to display Git status.

@ferrariofilippo
Copy link
Contributor

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

  • 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)?
  • What kind of menu should we use? A flyout or a modal?
  • What actions should be there? I was thinking of choosing the branch and creating a new one (what about inlcuding delete and rename?)

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?
  • 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

@yaira2
Copy link
Member Author

yaira2 commented Apr 10, 2023

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
Copy link
Contributor

So phase 1 will be:

  • Pull
  • Push
  • Sync
  • See branch name

@0x5bfa
Copy link
Member

0x5bfa commented Apr 11, 2023

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
Copy link
Contributor

ferrariofilippo commented Apr 12, 2023

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
Copy link
Member Author

yaira2 commented Apr 28, 2023

I updated the requirements for phase 2.

@ferrariofilippo
Copy link
Contributor

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

@yaira2
Copy link
Member Author

yaira2 commented May 5, 2023

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

@ferrariofilippo
Copy link
Contributor

ferrariofilippo commented May 9, 2023

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

@yaira2
Copy link
Member Author

yaira2 commented May 9, 2023

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

@0x5bfa
Copy link
Member

0x5bfa commented May 10, 2023

Amazing! Can you customize Flyout padding?

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

Branches label is styled strong text block style.

@ferrariofilippo
Copy link
Contributor

Like this?
image

@yaira2
Copy link
Member Author

yaira2 commented May 11, 2023

I updated the requirements for phase 3.

@yaira2 yaira2 moved this from 📋 Planning stage to 🔖 Ready to build in Files task board May 11, 2023
@ferrariofilippo
Copy link
Contributor

ferrariofilippo commented May 12, 2023

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
Copy link
Member

0x5bfa commented May 15, 2023

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

I highly recommend to use Preview Pane.

@yaira2
Copy link
Member Author

yaira2 commented May 15, 2023

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

Yes

@hez2010
Copy link
Member

hez2010 commented May 16, 2023

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
Copy link
Member

0x5bfa commented May 16, 2023

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
Copy link
Member Author

yaira2 commented May 16, 2023

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 yaira2 moved this from 🔖 Ready to build to 🏗 In progress in Files task board May 16, 2023
@yaira2
Copy link
Member Author

yaira2 commented May 22, 2023

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

@ferrariofilippo
Copy link
Contributor

What about deleting local branches?

@yaira2
Copy link
Member Author

yaira2 commented May 25, 2023

What about deleting local branches?

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

@yaira2 yaira2 closed this as completed Jun 30, 2023
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Files task board Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

6 participants