-
Notifications
You must be signed in to change notification settings - Fork 0
/
l2.txt
20 lines (14 loc) · 1.61 KB
/
l2.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Initializing a repository:
This creates a new repository in the current directory, including a .git folder. No commits are made yet.
Staging area:
Files in the working directory may be added to the staging area. In a commit, all files in the staging area are committed to the repository. The staging area allows you to choose exactly which files in the working directory should or should not be part of the repository.
Commit size:
Use git diff to compare your current changes with the staging area, which still contains the previous commits. If files have already been placed on the staging area, use git diff --staged to compare the staging area to the most recent commits. Either way, make sure the differences (your changes) only represent one logical change.
When to use branches:
When you want to make multiple experimental changes that you are not sure belong on the master branch. Extending each experimental change with new commits would be a lot of overhead if each change had to be on the same branch.
Diagrams visualize the branch structure:
Diagrams allow you to see at which file one branch separated from another. Access through git log --graph --oneline
Merging two branches:
This allows changes from two branches to be integrated together, ex. changes in an experimental branch can be integrated with the master branch, or two people's work can be merged together.
Git's automatic merging:
Automatic merging makes the boring task of combining two files easy. When there might be a conflict, Git does not "guess" and try to automatically merge, which may cause strange bugs. Instead, the coders are asked to correct the conflict.