If you mean you want the pull to overwrite local changes, doing the merge as if the working tree were clean, well, clean the working tree:
git reset --hard git pull
If there are untracked local files you could use git clean
to remove them.
git clean -f
to remove untracked files-df
to remove untracked files and directories-xdf
to remove untracked or ignored files or directories
If on the other hand you want to keep the local modifications somehow, you’d use stash to hide them away before pulling, then reapply them afterwards:
git stash git pull git stash pop
I don’t think it makes any sense to literally ignore the changes, though – half of pull is merge, and it needs to merge the committed versions of content with the versions it fetched.
Related Posts:
- How do I force git pull to overwrite everything on every pull?
- How do I ignore an error on ‘git pull’ about my local changes would be overwritten by merge?
- Why does git say “Pull is not possible because you have unmerged files”?
- How do I ignore an error on ‘git pull’ about my local changes would be overwritten by merge?
- Why does git say “Pull is not possible because you have unmerged files”?
- There is no tracking information for the current branch
- How do I ignore an error on ‘git pull’ about my local changes would be overwritten by merge?
- Files not updating using ‘git pull’
- git checkout tag, git pull fails in branch
- Why does git say “Pull is not possible because you have unmerged files”?
- Is it possible to pull just one file in Git?
- fatal: could not read Username for ‘https://github.com’: No such file or directory
- Git pull – Please move or remove them before you can merge
- Git push requires username and password
- How do I delete a Git branch locally and remotely?
- What is git tag, How to create tags & How to checkout git remote tag(s)
- Difference between “git add -A” and “git add .”
- Git: Message ‘src refspec master does not match any’ when pushing commits in Git
- What is the best (and safest) way to merge a Git branch into master?
- How can I switch to another branch in git?
- Squash my last X commits together using Git
- How to apply a patch generated with git format-patch?
- Abort a Git Merge
- GitHub: Permission denied (publickey). fatal: Could not read from remote repository
- How to delete a remote tag?
- Updates were rejected because the tip of your current branch is behind its remote counterpart
- Updates were rejected because the tip of your current branch is behind its remote counterpart
- Git: How do I force “git pull” to overwrite local files?
- What does “Changes not staged for commit” mean
- git: fatal: Could not read from remote repository
- How do I update Homebrew?
- Git error when trying to push — pre-receive hook declined
- How can I merge multiple commits onto another branch as a single squashed commit?
- Gitignore not working
- Could not open a connection to your authentication agent
- How to get just one file from another branch?
- git checkout a single file from another branch and put in different folder
- Update Git branches from master
- Stash only one file out of multiple files that have changed with Git?
- How to find my GitHub username so that I can be found via the URL?
- Create a branch in Git from another branch
- Create Git branch with current changes
- github website publish cannot publish unborn HEAD
- What is HEAD in Git?
- Why git asks to enter a commit message to explain why this merge is necessary
- What are the differences between git remote prune, git prune, git fetch –prune, etc
- How to get the current branch name in Git?
- How can I git stash a specific file?
- How to name and retrieve a stash by name in git?
- GitHub: invalid username or password
- Why do I have to “git push –set-upstream origin
“? - Stash just a single file
- Stash just a single file
- Git – Ignore node_modules folder everywhere
- How to undo ‘git reset’?
- fatal: Not a valid object name: ‘master’
- Git and nasty “error: cannot lock existing info/refs fatal”
- How do I delete a local repository in git?
- git pull from master into the development branch
- Clone A Private Repository (Github)
- Throw away local commits in Git
- Hard reset of a single file
- How to remove remote origin from a Git repository
- .gitignore and “The following untracked working tree files would be overwritten by checkout”
- How do I copy a version of a single file from one Git branch to another?
- Git: cannot checkout branch – error: pathspec ‘…’ did not match any file(s) known to git
- Heroku: How to change a Git remote on Heroku
- Invalid VCS root mapping – 3 errors on my project
- Updates were rejected because the remote contains work that you do not have locally
- What is the difference between pull and clone in git?
- How do I clone a single branch in Git?
- how to reset develop branch to master
- “fatal: HttpRequestException encountered.” Error with GitHub/Bitbucket Repositories due to dropping TLS-1.0 support
- Git’s local repository and remote repository — confusing concepts
- How do I set up Eclipse/EGit with GitHub?
- Repository size limits for GitHub.com
- How do i git push specific branch?
- git push origin master does not work
- How can I see which Git branches are tracking which remote / upstream branch?
- TortoiseGit-git did not exit cleanly (exit code 1)
- How to answer the git prompt in npm init for a local repo
- Add all files to a commit except a single file?
- failed to push some refs to [email protected]
- Git says “Automatic merge failed”, what does it mean?
- git pull remote branch cannot find remote ref
- How to configure git bash command line completion?
- How do I change the default location for Git Bash on Windows?
- How to stop tracking and ignore changes to a file in Git?
- Does running git init twice initialize a repository or reinitialize an existing repo?
- Eclipse EGit Checkout conflict with files: – EGit doesn’t want to continue
- Git Push Error: insufficient permission for adding an object to repository database
- WordPress with Git
- WordPress Git Workflow Help
- WordPress and Git – What folders should I track?
- Multiple copies of the same website: how to organize code/architecture?
- Pull latest stable release via git [closed]
- Why do the Roots theme CSS files not load (404)?
- Painless way to track remote Git repo for WordPress updates
- WordPress on git – need help with configuration
- What’s is the best stack for cPanel continuous deployment?