How do you merge two Git repositories?

A single branch of another repository can be easily placed under a subdirectory retaining its history. For example: This will appear as a single commit where all files of Rails master branch are added into “rails” directory. However the commit’s title contains a reference to the old history tree: Add ‘rails/’ from commit <rev> Where <rev> is a … Read more

Unlink of file Failed. Should I try again?

This could mean that another program is using the file, which is preventing git from “moving” the file into or out of the working directory when you are attempting to change branches. I have had this happen on Windows Vista where eclipse is the program “using” the file. The file may not be actually open … Read more

How can I reconcile detached HEAD with master/origin?

First, let’s clarify what HEAD is and what it means when it is detached. HEAD is the symbolic name for the currently checked out commit. When HEAD is not detached (the “normal”1 situation: you have a branch checked out), HEAD actually points to a branch’s “ref” and the branch points to the commit. HEAD is … Read more

Is there a git-merge –dry-run option?

As noted previously, pass in the –no-commit flag, but to avoid a fast-forward commit, also pass in –no-ff, like so: To examine the staged changes: And you can undo the merge, even if it is a fast-forward merge:

List submodules in a Git repository

You could use the same mechanism as git submodule init uses itself, namely, look at .gitmodules. This files enumerates each submodule path and the URL it refers to. For example, from root of repository, cat .gitmodules will print contents to the screen (assuming you have cat). Because .gitmodule files have the Git configuration format, you … Read more

Git removing upstream from local repository

Using git version 1.7.9.5 there is no “remove” command for remote. Use “rm” instead. or, as noted in the previous answer, set-url works. I don’t know when the command changed, but Ubuntu 12.04 shipped with 1.7.9.5. edit: a few people seem to have run into a situation where they do not have an “upstream” remote. … Read more

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