Git pull out of someone else's plug

We are two students working in our online repository (another repo), which is forked from a common upstream repo.

Suppose another student made changes, committed, and switched to his repo on a specific branch.

  • How to transfer these changes to my own local repository?

  • Do I need to commit and push these changes to my phased area?

Thank!

+4
source share
3 answers

(, other) own. Pull other/<branch> (, add-other-changes). (origin/add-other-changes). , add-other-changes, Pull Merge origin/master.

  • :

    # go into your own repo
    $ git remote add other <other-student-repo-url>  # add a new remote with other repo URL
    
    $ git fetch other        # sync/update local with other repo
    
    $ git checkout -b add-other-changes       # create a new branch named 'add-other-changes'                    
    $ git pull other <specific-branch-name>   # pull other/<branch> changes           
    
    $ git push origin HEAD    # push changes to your own(origin) forked repo `add-other-changes` branch
    
+8

. . . . , .

0

, . , ( ), , ( , ).

As soon as this is done, when the project participants want to find out if there are new changes on the remote control, they can perform it git remote updateor more often git fetch origin.

If you are working on a single branch and want to update the local branch using a remote device git pull origin <branh_name>

If you made changes that should be shared:

git add file_path_1 file_path_2 directory_path1 ...
git commit -m "<your brief message>"
git push origin <branch_name>
0
source

Source: https://habr.com/ru/post/1669355/


All Articles