-
Notifications
You must be signed in to change notification settings - Fork 0
/
Git Pick-Me-Ups.txt
44 lines (38 loc) · 1.98 KB
/
Git Pick-Me-Ups.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
Git is the industry-standard version control system for web developers
Use Git commands to help keep track of changes made to a project:
git init creates a new Git repository
git status inspects the contents of the working directory and staging area
git add adds files from the working directory to the staging area
git diff shows the difference between the working directory and the staging
area
git commit permanently stores file changes from the staging area in the
repository
git log shows a list of all previous commits
A remote is a Git repository that lives outside your Git project folder.
Remotes can live on the web, on a shared network or even in a separate
folder on your local computer.
The Git Collaborative Workflow are steps that enable smooth project
development when multiple collaborators are working on the same Git
project.
We also learned the following commands
git checkout HEAD filename: Discards changes in the working directory.
git reset HEAD filename: Unstages file changes in the staging area.
git reset commit_SHA: Resets to a previous commit in your commit history.
Additionally, you learned a way to add multiple files to the staging
area with a single command:
git add filename_1 filename_2
Git branching allows users to experiment with different versions of a
project by checking out separate branches to work on.
The following commands are useful in the Git branch workflow.
git branch: Lists all a Git project’s branches.
git branch branch_name: Creates a new branch.
git checkout branch_name: Used to switch from one branch to another.
git merge branch_name: Used to join file changes from one branch to
another.
git branch -d branch_name: Deletes the branch specified.
git clone: Creates a local copy of a remote.
git remote -v: Lists a Git project’s remotes.
git fetch: Fetches work from the remote into the local copy.
git merge origin/master: Merges origin/master into your local branch.
git push origin <branch_name>: Pushes a local branch to the origin
remote.