How to replace master branch in Git, entirely, from another branch? [duplicate]

You should be able to use the “ours” merge strategy to overwrite master with seotweaks like this: git checkout seotweaks git merge -s ours master git checkout master git merge seotweaks The result should be your master is now essentially seotweaks. (-s ours is short for –strategy=ours) From the docs about the ‘ours’ strategy: This … Read more

How do you merge two Git repositories?

If you want to merge project-a into project-b: cd path/to/project-b git remote add project-a /path/to/project-a git fetch project-a –tags git merge –allow-unrelated-histories project-a/master # or whichever branch you want to merge git remote remove project-a Taken from: git merge different repositories? This method worked pretty well for me, it’s shorter and in my opinion a … Read more

Remove file from latest commit

I think other answers here are wrong, because this is a question of moving the mistakenly committed files back to the staging area from the previous commit, without cancelling the changes done to them. This can be done like Paritosh Singh suggested: git reset –soft HEAD^ or git reset –soft HEAD~1 Then reset the unwanted … Read more

Is there a way to cache https credentials for pushing commits?

Since Git 1.7.9 (released 2012), there is a neat mechanism in Git to avoid having to type your password all the time for HTTP / HTTPS, called credential helpers. You can just use one of the following credential helpers: git config –global credential.helper cache The credential.helper cache value tells Git to keep your password cached … Read more

How do you stash an untracked file?

To stash your working directory including untracked files (especially those that are in the .gitignore) then you probably want to use this cmd: git stash –include-untracked Alternatively, you can use the shorthand -u instead of –include-untracked, or simply git stash –all which stashes all files, including untracked and ignored files. This bahaviour changed in 2018, … Read more

Throw away local commits in Git

If your excess commits are only visible to you, you can just do git reset –hard origin/<branch_name> to move back to where the origin is. This will reset the state of the repository to the previous commit, and it will discard all local changes. Doing a git revert makes new commits to remove old commits … Read more

How can I git stash a specific file?

EDIT: Since git 2.13, there is a command to save a specific path to the stash: git stash push <path>. For example: git stash push -m welcome_cart app/views/cart/welcome.thtml OLD ANSWER: You can do that using git stash –patch (or git stash -p) — you’ll enter interactive mode where you’ll be presented with each hunk that … Read more

Download a specific tag with Git

$ git clone will give you the whole repository. After the clone, you can list the tags with $ git tag -l and then checkout a specific tag: $ git checkout tags/<tag_name> Even better, checkout and create a branch (otherwise you will be on a branch named after the revision number of tag): $ git … Read more

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