I want to update my Photoz estimator from dp01 to dp02.
I already had a branch u/dagoret in delegate-contributions-dp02 and I don’t care about what is in it.
I wanted to start from the main branch status.
So I first went in my branch:
git checkout u/dagoret
then I copy the main into my branch as follow:
git reset --hard main
Then I put my new files in
delegate-contributions-dp02/photoz/
But when I want to push as follow:
sylvielsstfr@nb-sylvielsstfr photoz]$ git push origin u/dagoret
To github.com:rubin-dp0/delegate-contributions-dp02.git
! [rejected] u/dagoret → u/dagoret (non-fast-forward)
error: failed to push some refs to ‘github.com:rubin-dp0/delegate-contributions-dp02.git’
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.
hint: See the ‘Note about fast-forwards’ in ‘git push --help’ for details.
When I look with fit status
[sylvielsstfr@nb-sylvielsstfr photoz]$ git status
On branch u/dagoret
Your branch and ‘origin/u/dagoret’ have diverged,
and have 28 and 2 different commits each, respectively.
(use “git pull” to merge the remote branch into yours)
nothing to commit, working tree clean
Even if I do what git want (git pull):
sylvielsstfr@nb-sylvielsstfr photoz]$ git pull
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint: git config pull.rebase false # merge
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace “git config” with “git config --global” to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
What is the good way to overide user’s branch and to update it without any risk to erase something ?
Many thanks for any advice !