Reputation: 27
I am using Tortoisegit.
I am doing a Pull, but I am not getting the file from the remote repository.
Below are steps I am doing:
1) Dit Git Clone Got the repository to my local disk
2) Deleted one file manually (NOT using the delete option from Tortoise )
3) Doing 'Pull' using Tortosegit, But I am getting the file that I deleted
Tortoisegit returns with Success..
git.exe pull --progress -v --no-rebase "WB" master
From https://github.com/wb/WBR_01
* branch master -> FETCH_HEAD
= [up to date] master -> WB/master
Already up to date.
Success (2406 ms @ 25/08/2018 21:02:51)
Can anyone let me know why Pull us not getting the file from remote?
Thank you
Upvotes: 0
Views: 854
Reputation: 265161
You have to distinguish between the Git commit history and the changes in your local working directory. Both can co-exist in the same repository and need not necessarily have an effect on the other.
What you have done is deleted a file without telling Git about it. If you do git status
it will show you:
changes not staged for commit:
deleted: path/to/your/deleted/file
When you do a git pull
, Git will first fetch all remote commits and then try to merge them to your local branch (either by a real merge commit, or by doing a fast-forward). From the output you have posted, there are no new commits on the remote, so nothing will happen (your file is still deleted, but you have not told Git so).
Since the gist of your question is how to get the file back into your working directory, there are two options:
Use git checkout -- path/to/your/deleted/file
git checkout
can be used to move to different branches, but it can also be used to check out a specific version of a file. In your case, the version at HEAD
(the currently checked-out commit).
Use git reset --hard HEAD
to wipe out all local changes. Careful, there is no undo for this operation.
Upvotes: 0
Reputation: 1320
Git pull incorporates changes from the remote branch into your local branch. In your case, you do not have any new commits in the remote branch.
If you use TortoiseGit and you want to get the deleted file back you need to use "Revert" on the parent folder (or commit or repository status dialog). Right click to pop up the context menu and then select the command TortoiseGit → Revert. A dialog will pop up showing you the files that you have deleted(or changed) and can restore(or revert). Select those you want to restore(or revert) and click on OK.
Upvotes: 0
Reputation: 21
When you pull, your git client will connect to the configured remote and retrieve any new commits (fetch) and then attempt to apply them to your local branch (merge).
In your case there are no new commits and hence nothing to change.
If you want to throw away your local changes and have your working area reflect the current commit, you could either use the clean or reset commands.
Upvotes: 1