Pressing a branch when reinstalling from the main

We are a development team of 5 people. We have a leading branch, and whenever we work on something new, we simply create a new branch. When we finish this change, we push the branch to GitLab and execute the merge / pull request to merge with the master again.

I have a branch on my machine that I have been working on for about a week. There have been changes to master this week, so I'm doing this command in my branch:

git rebase master

Once this is done, I will do this in order to push my new branch:

git push origin some-branch

When I do this, I get this error:

hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.

I do what he offers, I do git pull origin some-branch. Now the changed files have been changed with text ===HEAD>. Therefore, I correct this and confirm my work.

git push origin some-branch, .

, git status :

# On branch some-branch
# Your branch and some-branch have diverged,
# and have 3 and 3 different commits each, respectively.

, - ?

+4
2

, . , git push -f .

rebase, Git, , , .

, , git status, . ; , .

, , , , , , / .

+4

, pull...

$ git commit -m "your commit" 
$ git stash
$ git pull
$ git stash apply
$ git push
-2

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


All Articles