How to move certain commits to be based on another branch in git?

This is a classic case of rebase –onto: # let’s go to current master (X, where quickfix2 should begin) git checkout master # replay every commit *after* quickfix1 up to quickfix2 HEAD. git rebase –onto master quickfix1 quickfix2 So you should go from o-o-X (master HEAD) \ q1a–q1b (quickfix1 HEAD) \ q2a–q2b (quickfix2 HEAD) to: … Read more

How can I view prior commits with git blame?

git blame -L 10,+1 fe25b6d^ — src/options.cpp You can specify a revision for git blame to look back starting from (instead of the default of HEAD); fe25b6d^ is the parent of fe25b6d. Edit: New to Git 2.23, we have the –ignore-rev option added to git blame: git blame –ignore-rev fe25b6d While this doesn’t answer OP’s … Read more

How do I create a new Git branch from an old commit? [duplicate]

git checkout -b NEW_BRANCH_NAME COMMIT_ID This will create a new branch called ‘NEW_BRANCH_NAME’ and check it out. (“check out” means “to switch to the branch”) git branch NEW_BRANCH_NAME COMMIT_ID This just creates the new branch without checking it out. in the comments many people seem to prefer doing this in two steps. here’s how to … Read more

How to commit my current changes to a different branch in Git [duplicate]

The other answers suggesting checking out the other branch, then committing to it, only work if the checkout is possible given the local modifications. If not, you’re in the most common use case for git stash: git stash git checkout other-branch git stash pop The first stash hides away your changes (basically making a temporary … Read more

How can one change the timestamp of an old commit in Git?

You can do an interactive rebase and choose edit for the commit whose date you would like to alter. When the rebase process stops for amending the commit you type in for instance: git commit –amend –date=”Wed Feb 16 14:00 2011 +0100″ –no-edit P.S. –date=now will use the current time. Afterward, you continue your interactive … Read more

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