Answer the question
In order to leave comments, you need to log in
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
Progress:
git rebase -i master - move all commits up to the fork to the master and swap C3 and C2
git commit --amend - make any changes to commit C2
git rebase -i master - swap C2 and
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 ?
Answer the question
In order to leave comments, you need to log in
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.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question