0

Is there a way to completely reset the local repo (discard all locally changed, new or deleted files) and replace it with the remote repo with dulwich.porcelain? I almost managed it using reset, clean and pull. However, I have troubles with deleted files in the remote repo - which are not deleted locally.

It seems that this a known bug in dulwich (https://github.com/dulwich/dulwich/issues/452). I still wanted to know, if someone could help me finding a workaround/solution for this problem?

chris
  • 131
  • 3

1 Answers1

0

Issue #452 is unrelated to this - clean() should remove deleted files. Please file a bug with a way to reproduce this specific issue.

jelmer
  • 2,405
  • 14
  • 27
  • If I delete a file in the remote repositroy and call `repo = porcelain.open_repo(local_path)` `porcelain.clean(repo=repo.path, target_dir=repo.path)` I have the feeling nothing happens (and the deleted file still exists in my local repo) – chris Feb 04 '21 at 20:44
  • and if I call `porcelain.pull(repo)` once, nothing happens. If it is called twice `porcelain.status(repo)` returns: `GitStatus(staged={'add': [b'deleted_file.txt'], 'delete': [], 'modify': []}, unstaged=[], untracked=[])` – chris Feb 04 '21 at 20:51
  • `clean` should delete locally created files if not in the remote - which works! My problem is: If I change something in Github (in browser) and pull afterwards with `porcelain.pull()` everthing is updated in my local repo EXCEPT deleted files - they simply stay in the local repo. – chris Feb 07 '21 at 17:38
  • do you have any idea? What do I do wrong? I would be really glad finding a solution for that...@jelmer – chris Feb 07 '21 at 18:39