You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
c. Open a text file, make a change and add the change to the branch via commit.
$ git commit changed_file
d. Interactively rebase your_name/feature/b with main while squashing your last commit with the commit before (mark as "squash") and dropping another commit of your preference with (mark as "drop").
$ git rebase -i main
e. Resolve the conflicts as you wish.
f. Create a PR to main from your_name/feature/b.
g. Check the commit history.
h. Write in the PR description what rebase did to the commit history.
Merge
a. Do steps 2. a-c with branch feature/a.
b. Merge main into your_name/feature/a.
$ git merge main
c. do steps 2. e-g.
d. Write in the PR description what merge did to the commit history.
Revert/change commits
Checkout branch feature/b again and checkout a new branch your_name/revert/feature/b or else.
Change a commit with multiple modified/added files.
$ git rebase -i HEAD~3
This shows you in the pop-up window of the interactive rebase the last three commits. This three commits should be the following now (the last hash of the revert commit differs).
Delete file10.txt and delete line 2 in file1.txt (# Another change in feature/b) so the file only has 1 line.
Amend the commit and modify the commit message, since file10.txt got deleted and the changes in file1.txt won't be committed.
$ git commit --amend
The "Changes to be committed" message should look now like the following:
# Changes to be committed:
# modified: file8.txt
Create a PR and write in the description in your own words what you did, in what situation these two commands might be helpful or if you already had a situation were this would have come in handy.
The text was updated successfully, but these errors were encountered:
Rebase/merge branches
a. Checkout branch
feature/b
.your_name/feature/b
withmain
while squashing your last commit with the commit before (mark as "squash") and dropping another commit of your preference with (mark as "drop").f. Create a PR to
main
fromyour_name/feature/b
.g. Check the commit history.
h. Write in the PR description what
rebase
did to the commit history.a. Do steps 2. a-c with branch
feature/a
.b. Merge
main
intoyour_name/feature/a
.d. Write in the PR description what
merge
did to the commit history.Revert/change commits
feature/b
again and checkout a new branchyour_name/revert/feature/b
or else.file10.txt
and delete line 2 infile1.txt
(# Another change in feature/b
) so the file only has 1 line.file10.txt
got deleted and the changes infile1.txt
won't be committed.The text was updated successfully, but these errors were encountered: