git doesn't see the changes in the branch, after
git push origin remote_branch and comparing with
master it doesn't show any changes, even though a lot of changes were made in the file but comparing with the master doesn't show any difference.
There is a suspicion that these changes have already been committed on this branch and removed, and now git does not see this commit and, accordingly, its changes.
Here is a picture:
git checkout -b new_branch git commit -m "some commits" git push origin new_branch git checkout -b my_new_branch_2 git pull origin new_branch
At this point, I get all the commits that were in the
new_branch branch and remove some changes in the
git push origin my_new_branch_2 git checkout master git merge my_new_branch_2
Here I merged with the master.
Now when we try to merge with mater from the
new_branch branch from which I previously pulled, it says that there are no changes in the
What is a "branch"
It's just a pointer to some commit. All commits are organized in a graph in which each commit (except the first one) has an ancestor. So for one commit, you can pull out the whole chain – up to the very first one. All the commits that are pulled like this are referred to as "commits on branch X" or "belonging to branch X".
Suppose it was like this:
A - B - C master \ D new_branch
git checkout -b do?
This command creates a new branch pointing to the same commit pointed to by the current branch:
git checkout -b my_new_branch_2 A - B - C master \ D new_branch, my_new_branch_2
That is, after executing this command, the branches
my_new_branch_2 are identical.
git pull origin имяветки
git pull command merges a branch from a remote repository into the current branch. If you freeze a commit that already belongs to the current branch (i.e., is available along the ancestor chain), then the merge will not make any changes.
If no one but you is pushing to the
new_branch branch, then it points to the same commit
D as the
my_new_branch_2 branch, so this command does nothing:
git pull origin new_branch
If after that you make more commits to
my_new_branch_2 , but do not change
new_branch , then the second one will actually be a “part” of the first one.
new_branch branch points to commit
D , which is an ancestor of
E , and therefore belongs to the
A - B - C master \ D new_branch \ E my_new_branch_2
When you merge
master , the commits of the
new_branch branch also come as part of that branch. Merge most likely occurs according to the "fast-forward" model – when the
master pointer simply moves forward to the
A - B - C - D new_branch \ E my_new_branch_2, master
Therefore, trying to refreeze
master does not work.