Delete all local git branches

The ‘git branch -d’ subcommand can delete more than one branch. So, simplifying @sblom’s answer but adding a critical xargs: or, further simplified to: Importantly, as noted by @adminndrewC, using git branch for scripting is discouraged. To avoid it use something like: Caution warranted on deletes!

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)