-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlesson_2_reflections.txt
43 lines (38 loc) · 2.69 KB
/
lesson_2_reflections.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Reflections :
Initializing a Repository :
1. What happens when you initialize a repository? Why do you need to do it?
- a .git repository has been created.
- to track the files every each logical changes is commit.
Staging Area:
2. How is the staging area different from the working directory
and the repository? What value do you think it offers?
- Staging area is an intermediated area between working directory and repository used by Git.
- git add < file_name > - to stage the changes to the staging area.
- git reset < file_name > - to remove the changes from the staging area.
- value <
it allows to add one file at a time.
finally git bundles the whole staging area into one commit and add to the repository.
Commit size :
3. How can you use the staging area to make sure you have one commit per logical change?
- Run git diff - to track the changes between working directory and staging area.
- Run diff --staged - to track the changes between staging area and the most recent commit in the repository.
- Run git commit (finally) to commit the changes to the repository.
- git reset --hard - to discard the changes either in working directory or the staging area.
When to use branch :
4. What are some situations when branches would be helpful in keeping your history organized? How would branches help?
- when we commit changes to experimental project which is a labeled branch.
- commit changes to only specific branch.
- branch will help to organize those commits under labeled branch.
Visualizing with diagram (Branching and Reachablitiy):
5. How do the diagrams help you visualize the branch structure?
- to understand the what is 'detach HEAD'.
- concept of reachability.
- how to retain the commit on detach HEAD by creating new branch with command git checkout -b new_brach-name.
Merging two branches :
6. What is the result of merging two branches together? Why do we represent it in the diagram the way we do?
- a new version containing the changes in both branches.
- git checkout branch1, git merge branch2 - branch2 merge into branch1 and commit on branch1 label.
Automatic vs Manual merging :
7. What are the pros and cons of Git’s automatic merging vs. always doing merges manually?
- automatic merging causes undesirable changes that may lead to program compilation doe not work.
- manually merging can resolve the merge conflict by which accepting which changes suits best for the project which git can not do.