@@ -9,23 +9,94 @@ Before we begin, ensure that following are installed
9
9
10
10
1 . Download git and install from git-scm.com
11
11
1 . Merge tool for use with git. In our case, we will go with p4merge visual merge tool (http://www.perforce.com/downloads/Perforce/20-User?qt-perforce_downloads_step_3=1#product-10 )
12
- 1 . AtomVCS (atom.io)
13
12
13
+ ##### Configure P4Merge
14
+ git config --global diff.tool p4merge
15
+ git config --global difftool.p4merge.cmd "p4merge.exe \$ LOCAL \$ REMOTE"
16
+ git config --global merge.tool p4merge
17
+ git config --global mergetool.p4merge.cmd "p4merge.exe \$ BASE \$ LOCAL \$ REMOTE \$ MERGED"
18
+ git config --global mergetool.p4merge.trustExitCode true
19
+ git config --global mergetool.p4merge.keepBackup false
14
20
15
- ### Configuration
21
+ 1 . AtomVCS editor can be downloaded from atom.io
22
+
23
+
24
+ ### Git Configuration
16
25
17
26
Once the git is installed, set the user email address and the user name
18
- * git config -user.email <email_address>
19
- * git config -user.name <user_name>
27
+ * git config -user.email <email_address>
28
+ * git config -user.name <user_name>
29
+
30
+ ## Aliases
31
+
32
+ Git allows you define your own aliases to make your life easier
33
+
34
+ ### Bare minimum aliases
35
+ git config --global alias.a 'add -A'
36
+ git config --global alias.b 'branch'
37
+ git config --global alias.c 'checkout'
38
+ git config --global alias.cb 'checkout -b'
39
+ git config --global alias.pr 'pull --rebase'
40
+ git config --global alias.pom 'push origin master'
41
+ git config --global alias.rc 'rebase --continue'
42
+ git config --global alias.ra 'rebase --abort'
43
+ git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
44
+ git config --global alias.lga "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --all"
45
+ git config --global alias.aliases "config --get-regexp alias"
46
+
47
+ #### Colorization
48
+ git config --global color.branch "auto"
49
+ git config --global color.diff "auto"
50
+ git config --global color.status "auto"
51
+ git config --global color.branch.current "yellow reverse"
52
+ git config --global color.branch.local "yellow"
53
+ git config --global color.branch.remote "green"
54
+ git config --global color.diff.meta "yellow bold"
55
+ git config --global color.diff.frag "magenta bold"
56
+ git config --global color.diff.old "red bold"
57
+ git config --global color.diff.new "green bold"
58
+ git config --global color.status.added "yellow"
59
+ git config --global color.status.changed "green"
60
+ git config --global color.status.untracked "cyan"
61
+
20
62
21
63
22
64
### Creating a new repository
23
65
24
- Create a new directory, go to teh newly created directory and perform init.
66
+ Create a new directory, go to teh newly created directory and do git init.
67
+
68
+ $ mkdir demo
69
+ $ cd demo/
70
+ $ git init
71
+ Initialized empty Git repository in c:/source/demo/.git/
72
+
73
+ This will create a local master and all your current will be in the 'master'
74
+
75
+ Now to add a file to the repository
76
+
77
+ - Create a file
78
+ - Add it to index (git add .)
79
+ - To check the status of the files under your repository (git status)
80
+ - commit the files to the local repository (git commit -m <comment >)
81
+
82
+ ### Working with branches
83
+
84
+ By default once the repository is created, you will automatically work in the "master" branch.
85
+ Recommendation is that any work should be carried out in a different branch (for ex: working, feature etc)
86
+
87
+ Creating a branch automatically switches the working branch to the new created branch (-b option creates a new branch)
88
+
89
+ $ git checkout -b working
90
+ Switched to a new branch 'working'
91
+
92
+ ## Clone a repository
93
+
94
+ ### WorkFlow
95
+
96
+ Local repository
97
+ Index
98
+ Final source of truth
25
99
26
- mkdir deleteme
27
- cd deleteme/
28
- git init
29
100
30
101
31
102
0 commit comments