GIT clone branch to older commit in another directory

I have 2 directories of the same project, let call them directories A and B.

These two folder were cloned from a master git repo in another location, so they both started out with the same git repo commit.

  • What is the best way to handle configuration files with git?
  • Efficient storage of binary files in a git repository
  • can't commit with sublime text git on Ubuntu 14.04
  • Cleaning up git history
  • Git works fine locally, but when accessing machine remotely Git asks for password
  • why does Git send whole repository each time push origin master
  • Now A stayed with the original code and fixed a few minor bugs, and commited the changes, so A git branch looks like this:

    A: (original)-(bug fix 1) - (bug fix 2) - (bug fix 3)
    

    While B, I decided to change the look of the application but I havent commited yet. so B git branch looks like this:

    B: (original)
    

    What I would like to do is merge these 2 git repos from the original clone so I can have the following:

    A: (original)-(bug fix 1) - (bug fix 2) - (bug fix 3)--------(merge both)
    
               \                                                    /
    branch B:   \ -----------------(New version look) -------------
    

  • hint: after resolving the conflicts, mark the corrected paths
  • How can I find out which of my local branches are tracking which remote branches?
  • capistrano - git ls-remote -h doesn't have the git url
  • Change case of a file on Windows?
  • Version Control System (Git) - Server vs Local clarification
  • Git not tracking a subdirectory
  • 2 Solutions collect form web for “GIT clone branch to older commit in another directory”

    If you can push back to that repo, but you don’t want to push B, you can:

    • go to your A local clone
    • add the B local clone as a remote:

      git remote add repoB ../B
      
    • fetch and merge:

      git fetch repoB
      git checkout A
      git merge repoB/B
      

    Hello I have 2 directories of the same project, let call them directories A and B. These two folder were cloned from a master git repo in another location,

    Instead of cloning the repositories use


    git worktree

    Git worktree was introduced in 2007 under the contrib folder in git repo and was called new-workdir. In git v2.5 is was renamed to worktree.

    The most simple syntax is this:

    git worktree add <second path>/<branch name>
    

    will create another folder on your computer which allow you to work on different branches simultaneously.

    git worktree will create 2 separate working folders separated from each other while pointing to the same repository.

    This will allow you do to any experimentals on the new worktree without having any effect on the repository itself. In the attached image you can see that there are 2 separate working folder but both of them are using a single repo and share the content.

    Here is a sample on how to create new worktree and what is the result of it:

    enter image description here

    What I would like to do is merge these 2 git repos from the original clone so I can have the following…

    Now since you are working on the same repository you can merge,cherry-pick without pulling or pushing to the remote since you dont need to use the remote.
    its all local !!!

    Git Baby is a git and github fan, let's start git clone.