git - basic commands

Before you read this blog entry please read The git parable. It is a nice read to understand the need and reason for git.

basic commands

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

#create the repository, first thing when creating a project
git init

#shows you the current status of your repository
git status

#adds files or directories to the staging area
git add filename

#commits the changes from the staging area to the repository
git commit -m 'commit message'

#shows the repositories graph
gitk --all

# to check the commits
git log

# get the last commit info
git log -1

# file which stores the ignore file patterns
.gitignore

#to checkout a commit
git checkout SHA1ID

#to check the differences between working dir and latest commit
git diff

#diff between those two commits
git diff commit_id1 commit_id2

#server #to push to a server
git push

#to manager remotes
git remote

# to get the latest commits
git fetch

I’ll update this post with more examples as I get the time


I am currently working on LiveForm which makes setting up contact forms on your website a breeze.