Skip to content

Pull removes untracked files locally #53

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

Open
emaincourt opened this issue May 3, 2020 · 7 comments · May be fixed by rilldata/go-git#1 or #1540
Open

Pull removes untracked files locally #53

emaincourt opened this issue May 3, 2020 · 7 comments · May be fixed by rilldata/go-git#1 or #1540
Labels
bug Something isn't working help wanted Extra attention is needed no-autoclose Issues/PRs to be ignored by stale bot

Comments

@emaincourt
Copy link

Hi,

Thank you for the great work you've been doing with go-git. I've used it to start a new project and it works really well.

As a new user I guess I might be doing something wrong, or miss a concept, but here I have a very basic Pull operation on a repository which looks like this:

if err := w.Pull(&gogit.PullOptions{}); err != nil {
	if err == gogit.NoErrAlreadyUpToDate {
		return nil
	}
	return err
}

The folder into which the repository lives also contains untracked files. If I run this pull operation with go-git, all the untracked files are being removed from the directory. On the other hand if run a manual git pull in my terminal from the same folder, untracked files get preserved as expected.

Could you please help me ?

Thanks in advance

@grvijayan
Copy link

I too have the same issue. I am commenting here hoping this gets bumped up.

@pete-woods
Copy link

pete-woods commented Jan 15, 2021

I am also suffering this issue. It seems to me like when this library tries to calculate the changes it needs to make to the filesystem, it is including untracked files in the current state (coming from here: https://github.com/go-git/go-git/blob/master/worktree_status.go#L128 in the code).

This appears to happen as part of the "reset" (in resetIndex) porcelain layer. I think (probably naively) that untracked files should be excluded in its diffTreeWithStaging call here: https://github.com/go-git/go-git/blob/master/worktree.go#L315.

@github-actions
Copy link

github-actions bot commented Oct 1, 2023

To help us keep things tidy and focus on the active tasks, we've introduced a stale bot to spot issues/PRs that haven't had any activity in a while.

This particular issue hasn't had any updates or activity in the past 90 days, so it's been labeled as 'stale'. If it remains inactive for the next 30 days, it'll be automatically closed.

We understand everyone's busy, but if this issue is still important to you, please feel free to add a comment or make an update to keep it active.

Thanks for your understanding and cooperation!

@github-actions github-actions bot added the stale Issues/PRs that are marked for closure due to inactivity label Oct 1, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 1, 2023
@pete-woods
Copy link

It's still a pretty serious bug

@pjbgf pjbgf added bug Something isn't working help wanted Extra attention is needed and removed stale Issues/PRs that are marked for closure due to inactivity labels Nov 3, 2023
@pjbgf pjbgf reopened this Nov 3, 2023
@pjbgf
Copy link
Member

pjbgf commented Nov 3, 2023

@pete-woods would you be able to share an example on how to reproduce the issue please?

@pete-woods
Copy link

pete-woods commented Nov 7, 2023

If I remember correctly, simply doing a "hard git reset" in a directory with untracked files is enough. Instead of only reverting tracked files, any untracked files are also deleted. This, of course, is not what's supposed to happen.

Copy link

github-actions bot commented Feb 9, 2024

To help us keep things tidy and focus on the active tasks, we've introduced a stale bot to spot issues/PRs that haven't had any activity in a while.

This particular issue hasn't had any updates or activity in the past 90 days, so it's been labeled as 'stale'. If it remains inactive for the next 30 days, it'll be automatically closed.

We understand everyone's busy, but if this issue is still important to you, please feel free to add a comment or make an update to keep it active.

Thanks for your understanding and cooperation!

@github-actions github-actions bot added the stale Issues/PRs that are marked for closure due to inactivity label Feb 9, 2024
@pjbgf pjbgf added no-autoclose Issues/PRs to be ignored by stale bot and removed stale Issues/PRs that are marked for closure due to inactivity labels Feb 9, 2024
BillXiang pushed a commit to BillXiang/go-git that referenced this issue Jul 24, 2024
BillXiang pushed a commit to BillXiang/go-git that referenced this issue Jul 25, 2024
BillXiang pushed a commit to BillXiang/go-git that referenced this issue Jul 25, 2024
k-anshul added a commit to rilldata/go-git that referenced this issue May 2, 2025
k-anshul added a commit to rilldata/go-git that referenced this issue May 2, 2025
k-anshul added a commit to rilldata/go-git that referenced this issue May 5, 2025
k-anshul added a commit to rilldata/go-git that referenced this issue May 6, 2025
k-anshul added a commit to rilldata/go-git that referenced this issue May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed no-autoclose Issues/PRs to be ignored by stale bot
Projects
None yet
4 participants