In: Computer Science
I. At the beginning, create a folder named "test" and add the folder into the version control tool tracking system. Then create one file named "001" under this folder. Commit any change if necessary.
II. Next, add another file named "002" in the same folder and commit the change ("adding") in the version control tool.
III. Followed by adding that file, create a branch (namely, "branch-A") in the version control tool and make some changes to the contents in file "001" under the newly created branch. Then commit the change from file "001".
IV. Create another branch (namely, "branch-B") from the main branch (NOT from "branch-A"!) in the version control tool and make some changes to the contents in file "002". Then commit the change from file "002".
V. The next step is to merge "branch-A" and "branch-B" and commit the change to the main branch. Record what you see from such an operation and make your own decision which version you want to keep.
VI. At last, Revise the current change from the merged result to the beginning where there was one file named "001". Record what you see from this operation.
(3) Show a graph of all version related operations from version control tool. The graph is used to visually depict how changes are made.
I. At the beginning, create a folder named "test" and add the folder into the version control tool tracking system. Then create one file named "001" under this folder. Commit any change if necessary.
mkdir test
cd test
git init
touch 001
echo "Commit this" >> 001
git add .
git commit -m "changes added"
II. Next, add another file named "002" in the same folder and commit the change ("adding") in the version control tool.
touch 002
echo "adding" >> 002
git add .
git commit -m "changes added"
III. Followed by adding that file, create a branch (namely, "branch-A") in the version control tool and make some changes to the contents in file "001" under the newly created branch. Then commit the change from file "001".
git checkout -b branch-A
git add .
git commit -m "branch A changes"
IV. Create another branch (namely, "branch-B") from the main branch (NOT from "branch-A"!) in the version control tool and make some changes to the contents in file "002". Then commit the change from file "002".
git checkout master
git checkout -b branch-B
echo "new changes in B" >> 002
git add .
git commit -m "branch B changes"
V. The next step is to merge "branch-A" and "branch-B" and commit the change to the main branch. Record what you see from such an operation and make your own decision which version you want to keep.
git checkout master
git merge branch-A
git merge branch-B
VI. At last, Revise the current change from the merged result to the beginning where there was one file named "001". Record what you see from this operation.
git log
git status
(3) Show a graph of all version related operations from version control tool. The graph is used to visually depict how changes are made.
git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
Please upvote the solution, comment in case of any doubts