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

"Discard All and Pull" feature not working #1074

Closed
willyyang opened this issue Feb 8, 2022 · 3 comments · Fixed by #1087
Closed

"Discard All and Pull" feature not working #1074

willyyang opened this issue Feb 8, 2022 · 3 comments · Fixed by #1087
Labels
bug Good first issue Good first issue to be tackled by new contributors status:Help Wanted

Comments

@willyyang
Copy link

willyyang commented Feb 8, 2022

Description

Unale to reset local git repository to remote repository once commit added to local git repo re: #1020

Reproduce

# Step 1: Open terminal and checkout a new branch
# add new file, git add, commit change, push change to remote 

git checkout -b test
echo 'this is a test' > test.txt
git add .
git commit -m 'adding to remote from terminal' 
git push origin X

# Step 2: checkout same branch in jupyterlab, make a change to test.txt, stage and commit (no push to remote)

# Step 3: Back to terminal, use same test branch, make a change to test.txt, git add, commit and push the change to remote

# Step 4: Back to jupyterlab, click on 'Discard All and Pull' button as seen from https://github.com/jupyterlab/jupyterlab-git/pull/1020

Error: Will now show as a popup: Error

remote: Enumerating objects: 3, done. remote: Counting objects: 33% (1/3) remote: Counting objects: 66% (2/3) remote: Counting objects: 100% (3/3) remote: Counting objects: 100% (3/3), done. remote: Total 3 (delta 1), reused 3 (delta 1), pack-reused 0 Unpacking objects: 33% (1/3) Unpacking objects: 66% (2/3) Unpacking objects: 100% (3/3) Unpacking objects: 100% (3/3), done. From XXXX/regression-test-notebooks a5b0396..d3ccd5c test -> origin/test Auto-merging test.txt CONFLICT (content): Merge conflict in test.txt Automatic merge failed; fix conflicts and then commit the result.

Expected behavior

The expected behavior would be for all of the staged, local changes to unstage and revert to the remote version of the file(s). Basically a reset hard on the remote head.

Context

# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"

# pip list | grep jupyterlab-git
jupyterlab-git         0.34.2

# jupyter labextension list
JupyterLab v3.2.8
  @jupyterlab/git v0.34.2 enabled OK (python, jupyterlab-git)

# jupyter server extension list
  jupyterlab_git enabled
  - Validating jupyterlab_git...
     jupyterlab_git 0.34.2 OK

# git --version
git version 2.20.1
@willyyang willyyang added the bug label Feb 8, 2022
@willyyang
Copy link
Author

Looking to target specific comment from #860 (comment) "just make my local copy look exactly like what's on the server"

@fcollonval
Copy link
Member

Thanks for the suggestion @willyyang

This may be indeed a more appropriate behaviour and will go in the direction of the feature wish of an advanced nbgitpuller mode #998

This will probably require changing the wording of the feature to clarify the behavior; something like Reset Current Branch to Remote state.

@fcollonval fcollonval added Good first issue Good first issue to be tackled by new contributors status:Help Wanted labels Feb 9, 2022
@willyyang
Copy link
Author

@fcollonval What we're really looking for is for a new button / that button to do a git reset --hard origin/master Hope that can be implemented :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Good first issue Good first issue to be tackled by new contributors status:Help Wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants