The detailed reason why remote git reboot is so evil

So, I'm starting from a centralized VCS background and trying to nail our workflow into Git (new company, young code base). One question I cannot find a simple but detailed answer to is what redirects to the remote branch do exactly. I understand that he is rewriting history, and in general should be limited only to local branches.

The workflow I'm trying to verify now includes a remote collaboration branch, each of which owns to share code. (With 2 developers and a maximum of 3 in the foreseeable future, the function branch for each project and the function request seem to be excessive and more overhead than the benefits.)

Then I stumbled upon this answer and tried it, and he did what I would like - the maiden will do and often click on his own branch of the call, when he knows what is approved to be released for the production, he can reinstall remotely ( to crush and possibly reorganize) before embarking on development.

Enter the original question - if the remote branch is designed to work together, someone else will pull it sooner or later. If the process / training issue is not related to fixing a “guest developer” for this call branch, then what actually happens to the owner of the branch, which reinstalls this remote branch?

+4
source share
2 answers

, .

:

  • Git . . - ( Git, , SHA-1) . ; /- ; ; , .

  • , - . -, ( ), , . Git .

  • (), , . - , , , , - . , :

    ...--o--*--o--o--o   <-- develop
             \
              o--o       <-- feature
    

    feature develop *, , feature develop, . :

    ...--o--*--o--o--o        <-- develop
             \        \
              \        @--@   <-- feature
               \
                o--o          abandoned [used to be feature, now left-overs]
    

    @ .

  • , develop, , . , "", @--@, .

  • . , develop master , , , .

  • , Git ( ) - Git , Git Git , -. , , Git.

  • - , Git, . origin/master , , Git, ", Git at origin , master , , ."

, , git fetch. , git fetch origin. Git Git origin . , master = 1234567 branch = 89abcde ( - 40 , 7-).

, Git . , ! , Git , , Git . , , () - , , , .., - () , . , . 1

Git , Git . Git , master 1234567, origin/master 1234567. branch: origin/branch, Git 89abcde.

git checkout branch, Git origin/branch, , 89abcde. :

...--o--*--o--1   <-- master, origin/master
         \
          o--8    <-- branch, origin/branch

( 1234567 1 89abcde 8), .)

- , branch. , aaaaaaa...:

...--o--*--o--1    <-- master, origin/master
         \
          o--8     <-- origin/branch
              \
               A   <-- branch

( aaaaaaa... A).

- , , - Git, - -. , , branch master. . git fetch, Git , branch = fedcba9. Git , ; , ( ) ( ) , - commit 1234567.

:

...--o--*--o--1        <-- master, origin/master
         \     \
          \     o--F   <-- origin/branch
           \
            o--8--A    <-- branch

F commit fedcba9, origin/branch .

, , branch ( origin/branch), , o--8--A, branch, origin/branch. , origin/branch, , . , , , .


1 "", "" , Git Git , Git: origin/master , master , master . , master, origin/master.

, . , Git , , . .


, Git 2.0 , , Git . ( , git merge-base --fork-point, git rebase --fork-point, origin/branch, , o--8 origin/branch . reflog , 30 , , . 30 : 30 git fetch, , upstream rebase.)

, , - () , , , , . , , - "" , , .

+6

( ) () , . , , , , , . .

0

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


All Articles