Merging Git Repositories

แชร์
ฝัง

ความคิดเห็น • 31

  • @roberth1687
    @roberth1687 5 ปีที่แล้ว +18

    Thank you for the helpful guide/tutorial. I couldn't remember all those commands. So I think it would be useful to sum it up for others here again: 1.) git remote add 2.) git fetch 3.) check to see whether remote is available with git remote -v 4.) Create a new branch with git checkout -b 5.) move all the files into a subdirectory so there aren't any conflicts with names (git mv) and commit that (git commit -m "moved") 6.) git checkout master 7.) git merge --allow-unrelated-histories 7.) cleanup everything with: git remote rm git branch -d 8.) check to see whether everything is correct with: git remote -v git branch -a -v git status 9.) git push

  • @martisavi9728
    @martisavi9728 6 ปีที่แล้ว +5

    Very useful tutorial. Just little update: since Git v2.9 you have to use: 'git merge bootcamp --allow-unrelated-histories'

  • @advocoates
    @advocoates 3 ปีที่แล้ว +3

    Many thanks for this video Juriy!
    The following command will move all files and folders to the new folder:
    git mv -k * nodecamp/
    The -k flag will skip any action that contains an error condition (such as moving the target directory to itself).

    • @francoisrobbertze
      @francoisrobbertze 4 หลายเดือนก่อน

      I also used -n to dry-run to double check the files it will rename. After using git mv -k * nodecamp/ (or whatever directory) I had to manually mv the .gitignore

  • @akashsahu3338
    @akashsahu3338 3 ปีที่แล้ว +2

    finally, finally and finally I got my solution to my problem. I'm that much happy I can't describe it. I know this problem is not that much big for some guys, but it's really very important for me because I am hustling since last week to find the answer to my query but now from this video, I got my answer. Thanks a lot, sir for this tutorial. I'm really grateful to you. Thank you so much, sir.

  • @SystemOfABeth
    @SystemOfABeth 4 ปีที่แล้ว +1

    Very clear and helpful, even 5 years later! Thank you so much!

  • @claretsnick
    @claretsnick 7 ปีที่แล้ว

    Great video, concepts well explained and a great walk through. Thanks!

  • @NetDaimoku
    @NetDaimoku 6 ปีที่แล้ว

    Hi Juriy,
    Thanks for the tutorial. It was very helpful and connected the dots I was missing.

  • @devexpo
    @devexpo 4 ปีที่แล้ว +1

    Very useful! Thanks :)
    Btw: the command to select and move all files inside a folder just type "mv * newFolderName" (without quotes).

  • @alissonreinaldosilva1119
    @alissonreinaldosilva1119 3 ปีที่แล้ว +4

    To move everything in new folder without the "fatal: can not move directory into itself", you can use "git mv -k * ./subDir". The "-k" option will simply skip all actions that would produce an error, like trying to move "/subDir" inside itself.

    • @lunte0198
      @lunte0198 ปีที่แล้ว

      Seems like it does not work on windows

    • @lunte0198
      @lunte0198 ปีที่แล้ว

      Never mind, can be done via Git Bash

  • @kiranpariyar6991
    @kiranpariyar6991 6 ปีที่แล้ว

    Nice tutorial. Many many thanks.

  • @assonancex
    @assonancex 2 ปีที่แล้ว

    This is a great video Juriy

  • @AbhishekA-81
    @AbhishekA-81 3 ปีที่แล้ว

    I'm having already existing Repository with a directory inside it. So whenever I try to add another Directory to the same Repository using git it gets overwritten, what should I do.

  • @Abdelazizfouad
    @Abdelazizfouad 4 ปีที่แล้ว

    You r the best :)

  • @PratyshRaizada
    @PratyshRaizada 7 ปีที่แล้ว

    Hi Juriy!
    I synced the repos successfully by following the steps shown in the video. Is there any way through which we can do the same without making a commit id for the merge operation. In the above method a commit id is generated (I wish if that can be done without that ID).
    I explored other methods like post-commit hooks that can be an answer to my query. Any links will be helpful.
    Thanks!

    • @JuriyBura
      @JuriyBura  7 ปีที่แล้ว

      Hi! I'm not quite sure I understood your question correctly. Whenever you do "merge" git will create a new commit, unless this is a fast-forward merge. Also, since git's commit ID is a hash of commit content (including author, time and message) you don't have a control over ID generation. It is just SHA-1.
      Could you explain what exactly you want to achieve, I'll try to give a better suggestion.

  • @nidhikapoor2847
    @nidhikapoor2847 2 ปีที่แล้ว

    When moving all files to nodecamp folder, losing the history
    Which git version you are using here
    Or any alternative you can suggest to move files into nodecamp without losing history

  • @andycascade
    @andycascade 4 ปีที่แล้ว +1

    Уж и забыл старый дизайн гитхаб, сколько лет уж прошло, Юрец...

  • @simplysnehit2331
    @simplysnehit2331 7 ปีที่แล้ว

    HI Juriy,
    In Github I have 1 working repository (2 branches Dev/QA) and 1 main repository(multiple branches ) .Main repo is your backbone and from here code goes to UAT.
    I need something like pull request between to repository ,so i can compare there branches and merge it to my main repository ...
    Appreciate your help.
    Thanks.

    • @JuriyBura
      @JuriyBura  7 ปีที่แล้ว

      If you don't have something like github or gitlab then "pull requests" between repositories will be quite tricky. Check out git-reqeust-pull command. git-scm.com/docs/git-request-pull. However this looks like an overly complex solution to me. I would suggest to use a backend like GitHub, Bitbucket or GitLab to manage pull requests for you.

    • @simplysnehit2331
      @simplysnehit2331 7 ปีที่แล้ว

      Thanks for replying.
      I'm using GitHub for remote repo.
      In single repo able to create pull request.But how to compared 2branches of 2 different repository?

  • @Jacob0246810
    @Jacob0246810 2 ปีที่แล้ว

    Starts at 1:42 when Juriy starts merging "nodecamp" repository into "trainings"

  • @kosm4308
    @kosm4308 5 ปีที่แล้ว +2

    5:20 when i have to move all files in ./ a create one level up a folder : mkdir ../ ; mv ./* ../ ; mv ../ ./

  • @softwaredeveloper3676
    @softwaredeveloper3676 2 ปีที่แล้ว

    Hi, Juriy. Awesome video, can you please tell me if the commits remain in history, as an example: I made an complex application in 2021 and I made like 500 commits, do they remain saved in commits history?

  • @ivand58
    @ivand58 5 ปีที่แล้ว

    mv $(ls -1a |grep -v nodecamp | grep -vw \.) nodecamp