-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit_notes
More file actions
87 lines (68 loc) · 2.06 KB
/
Copy pathgit_notes
File metadata and controls
87 lines (68 loc) · 2.06 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
86
87
#########################
# Making the repository #
#########################
Making a git repository, first step:
$ git init
Make a file to ignore some files when doing git status:
$ touch .gitignore
Add the name of files/folders we don't want to show up in status to the .gitignore file
To add this (or some other file)
$ git add .gitignore
Commands to create a user name and email for myself:
$ git config --global user.email "johan.h.thoren@thep.lu.se"
$ git config --global user.name "Johan Thoren"
##########################
# Some standard commands #
##########################
To see the status of all the files in the repository
$ git status
To see a log of commits
$ git log
Option
$ git log --oneline
To commit changes
$ git commit -m "a useful message"
To change version
$ git checkout master
can give the hash for the version from git log
Make a branch
$ git checkout -b testing
To see what branch we're on at the moment
$ git branch
To see what's happening with the branches
$ git log --oneline --graph -- decorate --topo-order --all
##################
# Create aliases #
##################
Do
$ git config --global alias.co checkout
$ git config --global alias.br branch
$ git config --global alias.ci commit
$ git config --global alias.st status
Can also go into the file ~/.gitconfig, which looks like
=== Start of file ===
[user]
email = johan.h.thoren@thep.lu.se
name = Johan Thoren
[alias]
co = checkout
br = branch
ci = commit
st = status
logall = log --oneline --graph --decorate --topo-order --all
=== End of file ===
#################################
# Putting the repository online #
#################################
Can put the repository on github (will be public unless one pays for it)
$ git remote add origin https://github.com/jThoren/comppy17.git
$ git push -u origin master
To create a copy of the repository from github
$ git clone https://github.com/jThoren/comppy17
To push/pull changes from the local repository to the github repository
$ git push
$ git pull
###########
# Forking #
###########
It's like a clone, but between two github accounts