Git: How do I force “git pull” to overwrite local files?

⚠ Important: If you have any local changes, they will be lost. With or without –hard option, any local commits that haven’t been pushed will be lost.[*] If you have any files that are not tracked by Git (e.g. uploaded user content), these files will not be affected. First, run a fetch to update all origin/<branch> refs to latest: Backup your … Read more

Git: cannot do a partial commit during a merge (SourceTree)

After updating the SourceTree to it’s latest version I am fighting with this issue. Assume following scenario: There are file A, B and C under the version control and there is just one branch. In my working copy, I make some changes to the file A so it turns into a A’ as well as the file B to B’. Someone else in his working copy makes … Read more

Undo git pull, how to bring repos to old state

Running git pull performs the following tasks, in order: git fetch git merge The merge step combines branches that have been setup to be merged in your config. You want to undo the merge step, but probably not the fetch (doesn’t make a lot of sense and shouldn’t be necessary). To undo the merge, use git reset –hard to reset the local repository to … Read more

What is the difference between ‘git pull’ and ‘git fetch’?

In the simplest terms, git pull does a git fetch followed by a git merge. You can do a git fetch at any time to update your remote-tracking branches under refs/remotes/<remote>/. This operation never changes any of your own local branches under refs/heads, and is safe to do without changing your working copy. I have even heard of people running git fetch periodically in a cron … Read more

Undo git pull, how to bring repos to old state

Running git pull performs the following tasks, in order: git fetch git merge The merge step combines branches that have been setup to be merged in your config. You want to undo the merge step, but probably not the fetch (doesn’t make a lot of sense and shouldn’t be necessary). To undo the merge, use git reset –hard to reset the local repository to … Read more

Git: How to squash all commits on branch

Another way to squash all your commits is to reset the index to master: This isn’t perfect as it implies you know from which branch “yourBranch” is coming from.Note: finding that origin branch isn’t easy/possible with Git (the visual way is often the easiest, as seen here). Note: git branch –show-current has been introduced with Git 2.22 (Q1 20219). EDIT: you will … Read more

How can I make git accept a self signed certificate?

To permanently accept a specific certificate Try http.sslCAPath or http.sslCAInfo. Adam Spiers’s answer gives some great examples. This is the most secure solution to the question. To disable TLS/SSL verification for a single git command try passing -c to git with the proper config variable, or use Flow’s answer: To disable SSL verification for a … Read more