-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlesson_2_reflections.txt
54 lines (41 loc) · 2.63 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
44
45
46
47
48
49
50
51
52
53
54
What happens when you initialize a repository? Why do you need to do it?
Git creates the .git directory containing its internal structures. This
is needed, as it is the place where git keeps information about the files
it is tracking, their history, commits, and all other git objects.
How is the staging area different from the working directory and the repository?
What value do you think it offers?
The staging area stores files and state that will go into the next commit.
It is different from the repository in that it can still change and those
changes will not be part of the history. Further changes to the working
directory will not affect the staging area.
How can you use the staging area to make sure you have one commit per logical
change?
I can selectively add to the staging area from the working directory only
the changes that make logical sense for the commit.
What are some situations when branches would be helpful in keeping your history
organized? How would branches help?
When working on experimental features, or even on new large features, when
working in teams, it is useful to create a branch that isolates that work
in its own "space". In this way, colleagues are not affected by the ongoing
unfinished work; large features that require work for long periods of time
may be in unusable state and it is always good to be able to switch to the
working version and apply a small change or fix.
How do the diagrams help you visualize the branch structure?
To draw the diagrams one must think about the branch structure step-by-step.
After having the diagram drawn, it is easier to visualize the global
picture.
What is the result of merging two branches together? Why do we represent it in
the diagram the way we do?
Merging two branches together merges the contents of the files in the
directory tree, keeping the changes that were made to both branches, and
it creates a new commit with two parents — one from each of the branches.
That is the reason why the diagram is drawn with the merge commit connected
to two parent commits.
What are the pros and cons of Git’s automatic merging vs. always doing merges
manually?
Completely manual merges would be very tedious and burdensome. Automatic
merging is a big help in that it does most of the straightforward work for
us. On the other hand, when git cannot determine how to merge a file or
more, it is necessary to merge manually because only a programmer with
knowledge of the language and the context can properly fix the conflict,
perhaps even with the help of other programmers.