Commit ef959e5c authored by Michal Hečko's avatar Michal Hečko
Browse files

Merge branch 'hw2' into 'main'

Hw2

See merge request red-hat/mastering-git!29
parents 86c473a6 a6fb7c3f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
I've learnt
- what is the difference between HTTPS and SSH access to the repo;
- about some "standards" of managing a repo (e.g., a linear history vs keeping merge commits) and that there is no single "good" way (it depends on preferences of the group/project)
- that we have git stash and what it is good for
- some "advanced" information related to git commands and actions that I had already been using (commands like checkout, pull, push, merge, fetch)

Thanks guys, I'm really enjoying the course so far :)
 No newline at end of file
+45 −0
Original line number Diff line number Diff line
git remote show  [only origin there --> I need to add upstream first]
git remote add upstream https://gitlab.fi.muni.cz/red-hat/mastering-git.git
git remote show  [origin, upstream]

[I want to have my repo up-to-date --> I will first pull changes from upstream]
git log --oneline --graph --all
git pull --help  [not sure about the syntax --> check the docs]
git pull upstream --rebase  [git complains about not knowing which branch to pull from --> nothing has changed after this command]
git pull upstream main --rebase
git log --oneline --graph --all  [my commits from HW1 were added on top of commits from the upstream]

[do HW2]
[1. create the file]
touch class3_homework/456675.txt
[write into it using any text editor]
[2. push it to origin]
git add class3_homework/456675.txt
git commit -m "hw2: added file describing what I've learnt so far"
git log --oneline --graph --all
git status  ["Your branch and 'origin/main' have diverged, use git pull"]
git pull origin main  [I wanted to see how git solves this situation so I did not use --rebase]
git status ["Your branch is ahead of 'origin/main' by 6 commits, use git push"]
git log --oneline --graph --all
git push -u origin main
git log --oneline --graph --all
[3. create a merge request to upstream]
git pull upstream main  [just to be sure: git wrote "Already up to date.", just as I could see in the log]
git push --help  [not sure how to create MR from CL --> check the docs]
git merge --help
[in the end, I found this page: https://docs.oracle.com/en/cloud/paas/visual-builder/visualbuilder-manage-development-process/create-merge-request-command-line.html whose commands I tried to replicate]
[this is the CL command that I've put togther: git push -o mr.target=main -o mr.summary="HW2: merge changes from fork (456675)" upstream main]
[still, I am not sure if/how to create a merge request via CL and I don't want to "harm" the upstream --> I rather created the MR from GitLab GUI :/]
[4. create the commands file and push it to origin - same as in HW1, so I'm not listing the commands here]


[FIX HW2]
git switch main
git branch hw2
git switch hw2
git push origin -u hw2
[update this file]
git add class3_homework/456675_commands.txt
git commit -m "hw2 fix: updated commands file"
git push origin -u hw2