-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGit_Installation.txt
More file actions
85 lines (60 loc) · 3.05 KB
/
Git_Installation.txt
File metadata and controls
85 lines (60 loc) · 3.05 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Entering our Identity
The first thing you should do when you install Git is to set your user name and e-mail address. This is important because every Git commit uses this information, and it’s immutably baked into the commits you pass around:
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
Again, you need to do this only once if you pass the --global option, because then Git will always use that information for anything you do on that system.
If you want to override this with a different name or e-mail address for specific projects, you can run the command without the --global option when you’re in that project.
# Checking the Settings
If you want to check your settings, you can use the git config --list command to list all the settings Git can find at that point:
$ git config --list
user.name=Scott Chacon
user.email=schacon@gmail.com
color.status=auto
color.branch=auto
color.interactive=auto
color.diff=auto
...
$ git config user.name
Scott Chacon
# Getting Started
**update this**
# Cloning a Repository
You clone a repository with git clone [url]. For example, if you want to clone the Ruby Git library called Grit, you can do so like this:
$ git clone git://github.com/schacon/grit.git
That creates a directory named grit, initializes a .git directory inside it, pulls down all the data for that repository, and checks out a working copy of the latest version. If you go into the new grit directory, you’ll see the project files in there, ready to be worked on or used. If you want to clone the repository into a directory named something other than grit, you can specify that as the next command-line option:
# Create a new branch and push into it.
$ git init
$ git add .
$ git commit -m "Librarian control to Admin"
$ git pull
$ git checkout -b librarian_removal
$ git push origin librarian_removal
$ git branch -a
$ git checkout master
$ git pull https://gitea.geminisolutions.in/ar.sharma1/Gem-Library.git librarian_removal
$ git push origin master
# To make changes to a cloned project and push them directly.
$ git branch
$ git add/rm <file_name>
$ git commit -m "Message Here"
# to fetch all the latest changes from the master branch
$ git fetch -v --all
# Write our changes on top of the fetched changes
$ git rebase
$ git push origin <branch_name>
# Cherry Pick a commit from branch1 to branch2.
$ git checkout <branch1>
$ git checkout <branch2>
$ git cherry -v branch2 branch1
# This will show the list of all the commits in branch2 that were made after the split from branch1.
$ git cherry-pick <commit_reference>
# Then create a single commit for all commits
$ git rebase -i
Edit the 'pick' into 's' for all the commits except the first one to squash them into a single commit.
# How to show a particular commit including the changes
# This will show all the recent commits in the chronological order
$ git log
# Pick the commit hash of the commit that you wish to see and use it in the below command
$ git show <commit-hash>
# To show the differences in the uncommited code and the master(origin)
$ git diff