M
M
magistr48152018-05-13 16:21:00
git
magistr4815, 2018-05-13 16:21:00

Pull changes from the branch - how to complete the level in 4 teams?

Good afternoon, I decided to deal with the git, I found an interesting service (learngitbranching.js.org - Collective hodgepodge - level 2 "Juggling commits"), which tells everything about it. I'm trying to pass the level for 4 teams, that's how much you need. But it only takes 5.
Task:
- Rearrange the commit so that the desired one is at the top with git rebase -i
- Commit changes with git commit --amend
- Rearrange everything back with git rebase -i
- Finally, move master to modified part of the tree to complete the level.
I don't understand how to do this task in one command!
Initially we have:
* - means that we are on this branch, i.e. we are on the branchcaption
5af83549b7540528502854.jpeg
Progress:
git rebase -i master - move all commits up to the fork to the master and swap C3 and C2
5af8396d0d478150815019.jpeg git commit --amend - make any changes to commit C2
5af839a8c5d3b410854767.jpeg git rebase -i master - swap C2 and
5af83b5d11772605885457.jpeg
C3 you need to somehow, being in the caption branch, pull the changes to master in one command ... I don’t understand how to do this.
I did this:
git checkout master - go to the master
git rebase caption - there is also a small question here : according to the idea, with this command we had to MOVE all commits from the branch in which we are now (master) to (caption)on top, but there are fewer commits in the master, why are we going to copy it there? C0 ? In general, it is not entirely clear how it works so that we insert commits from (caption) into (master ) . Bottom line: how to do a pull-up in one command without git cherry-pick , and how does rebase work weirdly ?
5af83a232a358382552138.jpeg

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Y
youngmysteriouslight, 2018-05-13
@youngmysteriouslight

Fourth action (moving master to C3'' when HEAD->caption)
I would not have known if not for one of the tasks, and used a bunch of git checkout master && git reset --hard caption.
Regarding git rebase caption (when we are in master). Fast-forward is triggered there, so the branch automatically moves forward. To remove this effect, write git rebaes --no-ff. Interactive mode disables ff by default.

A
a_reg, 2019-06-21
@a_reg

I wrote like this:
git branch -f master HEAD C3''

7
7SoKKoS7, 2022-02-20
@7SoKKoS7

git rebase -i master - swap C2 and C3
after git rebase caption master

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question