-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit-notes.txt
78 lines (51 loc) · 3.67 KB
/
git-notes.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
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
basic stuff for git
1- when using git you have set a username and a email so that way when you push to a repository aka
"update the github repository" it knows who did it.
you would use these commands to set the name and email you will use.
$ git config --global user.name "John Doe"
$ git config --global user.email [email protected]
using the "git config" command you can also set which editor you want to use when you write notes for
each commit.
$ git config --global core.editor emacs
if you want to see what your config files are set to so far put...
$ git config --list
2-now that you have your config set up (you can do way more to it) you can now make a repository.
in this case on the cwolf server, go into the directory you want to make into a repository and put..
$ git init
this makes a git repo in that directory and makes a .git directory, which doesn't show but you can
enter it.
if you dont want to use a directory on the cwolf server and use a repo thats already on github you
have to clone it over to the cwolf server. Remembe though, you still have to make a repo on the cwolf
server with "git init" before you clone stuff from github repo into the cwolfserver repo
$ git clone git@githubWhaetverRepoFromGithub master <-- i think thats right
there is also git pull
$ git pull git@githubWhwatverRepoFromGitHub master <-- this pulls files from whatever repo on github
and adds them to your local repo. Note it grabs
from master.. you can choose a branch if you
want?
$ git add remote origin http://UrlOnGitHubForThatRepository //so we know where are files are pushed
$ git add file // this puts the file into the staging area
$ git status // this shows which files are in the staging area
$ git diff //shows the difference between the files you modified
$ git commit // this commits the files that are in the staging area. you can do git commit -m "comment"
$ git log // shows the commits you made to that repository and the note you put for that commit
$ git push origin master // pushes the commit to the remote repository aka github. master means you
// are pushing it to the master, and 'origin' is the web url of the repo
// on github. it should also ask for the github id and pass.
Master is the main version of the project you are working on. If you want to add stuff and
test it first before you add it to master you would then make a 'branch' which is basically a
copy of master that you can add stuff to and it wont mess up the main version. Once you got your
changes to work then you can "i think its merge?" the branch with the master and that applies the
changes i think.
//-------------------------------------------
check out this website for learning git
http://git-scm.com/book
ALSO IF YOU GET THIS ERROR:
gnome-ssh-askpass:13543): Gtk-WARNING **: cannot open display:
put this command in and it will fix it!
$ unset SSH_ASKPASS
//---------------------------------------------
This was easy for me to understand so im putting it in:
git clone is how you get a local copy of an existing repository to work on. It's usually only used once for a given repository, unless you want to have multiple working copies of it around. (Or want to get a clean copy after messing up your local one...)
git pull (or git fetch + git merge) is how you update that local copy with new commits from the remote repository. If you are collaborating with others, it is a command that you will run frequently.
As your first example shows, it is possible to emulate git clone with an assortment of other git commands, but it's not really the case that git pull is doing "basically the same thing" as git clone (or vice-versa).