Remove folder and its contents from git/GitHub’s history

WARNING: git filter-branch is no longer officially recommended If you are here to copy-paste code: This is an example which removes node_modules from history git filter-branch –tree-filter “rm -rf node_modules” –prune-empty HEAD git for-each-ref –format=”%(refname)” refs/original/ | xargs -n 1 git update-ref -d echo node_modules/ >> .gitignore git add .gitignore git commit -m ‘Removing node_modules … Read more

What is the difference between merge –squash and rebase?

Merge commits: retains all of the commits in your branch and interleaves them with commits on the base branch Merge Squash: retains the changes but omits the individual commits from history Rebase: This moves the entire feature branch to begin on the tip of the master branch, effectively incorporating all of the new commits in … Read more

What’s the difference between ‘git merge’ and ‘git rebase’?

Suppose originally there were 3 commits, A,B,C: Then developer Dan created commit D, and developer Ed created commit E: Obviously, this conflict should be resolved somehow. For this, there are 2 ways: MERGE: Both commits D and E are still here, but we create merge commit M that inherits changes from both D and E. … Read more

Git refusing to merge unrelated histories on rebase

You can use –allow-unrelated-histories to force the merge to happen. The reason behind this is that default behavior has changed since Git 2.9: “git merge” used to allow merging two branches that have no common base by default, which led to a brand new history of an existing project created and then get pulled by … Read more

Undoing a git rebase

The easiest way would be to find the head commit of the branch as it was immediately before the rebase started in the reflog… git reflog and to reset the current branch to it (with the usual caveats about being absolutely sure before reseting with the –hard option). Suppose the old commit was HEAD@{2} in … Read more

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