How can I move HEAD back to a previous location? (Detached head) & Undo commits

Before answering, let’s add some background, explaining what this HEAD is. First of all what is HEAD? HEAD is simply a reference to the current commit (latest) on the current branch. There can only be a single HEAD at any given time (excluding git worktree). The content of HEAD is stored inside .git/HEAD and it … Read more

Re-doing a reverted merge in Git

You have to “revert the revert”. Depending on you how did the original revert, it may not be as easy as it sounds. Look at the official document on this topic. —o—o—o—M—x—x—W—x—Y / —A—B——————-C—D to allow: —o—o—o—M—x—x——-x——-* / / —A—B——————-C—D But does it all work? Sure it does. You can revert a merge, and from … Read more

What’s the difference between Git Revert, Checkout and Reset?

These three commands have entirely different purposes. They are not even remotely similar. git revert This command creates a new commit that undoes the changes from a previous commit. This command adds new history to the project (it doesn’t modify existing history). git checkout This command checks-out content from the repository and puts it in … Read more

How do I use ‘git reset –hard HEAD’ to revert to a previous commit? [duplicate]

First, it’s always worth noting that git reset –hard is a potentially dangerous command, since it throws away all your uncommitted changes. For safety, you should always check that the output of git status is clean (that is, empty) before using it. Initially you say the following: So I know that Git tracks changes I … Read more

Rollback to an old Git commit in a public repo

Try this: git checkout [revision] . where [revision] is the commit hash (for example: 12345678901234567890123456789012345678ab). Don’t forget the . at the end, very important. This will apply changes to the whole tree. You should execute this command in the git project root. If you are in any sub directory, then this command only changes the … Read more

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