-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgit.txt
More file actions
executable file
·73 lines (62 loc) · 2.8 KB
/
Copy pathgit.txt
File metadata and controls
executable file
·73 lines (62 loc) · 2.8 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
### What is a VCS?
A version control system is a software to manage a project by having all the different versions of your files saved
Some examples are git, mercurial (hg), subversion (svn)
### What is git?
Git is a VCS developed by Linus Torvalds for the development of the Linux Kernel, in 2005
### What is a repository?
Basically another name for a project
A repository can have as many files/folders as you want
All git data is stored in repositories
### git commands -
git config -- setting name and email
git init -- initializing a repository
Make some files, add only some
git status (showing files unstaged, staged)
git diff (, git diff --cached)
### What is a commit?
Basically like a save
Can also consider it a snapshot of various states in your git repository
Can by identified by its unique hash
A commit can be revereted back to run back in previous state of repository.
Make a commit
Browse directory at previous commit
Git status at bash
git commit (Explain -a, -m flags)
(Create a few commits to get a small log to work on)
git log (Show some flags like --author, --committer, --oneline)
git show (git show to show current HEAD, git show <sha> to show a certain commit)
git revert
git reset
git checkout
### Git and GitHub
1) Clone repository on your local machine by using:
git clone <repository-link>
2) Edit the file and save it.
3) Stage the file for commit using
git add . (Here "." means to stage all the files you have added/changed. Specofy file name if you
wish to add stage a specific file(s).
4) Commit changes using
git commit -m "<Commit Message>"
5) Push the commited changes from your local machine to GitHub using:
git push -u origin (Here -u means "upstream" and origin means the origin repository which you cloned from GitHub)
6) When working on a repository with multiple contributors, everytime on a new session,
use "git pull origin" to load the changes commited by other contributors in your local machine.
Tell them about services like github, gitlab, etc.
Then make sure everyone has a github account, and show them how to create a repository and push
Then show them how they can view the log in the commits tab, check what a commit changed, etc.
How to edit and commit files online directly.
How to clone a repository from github or pull into an existing local repository
ksdfg:
make a repo online
what a remote is
Basically another name for a project
A repository can have multiple files
push repo on hub
add files, upload files
commit history, browse files at previous commit
pull repo onto bash
go to hub, make a branch, make some change
pull repo first, show no branch in git branch, then pull branch
go to github, start a pull request from branch
clone - bash guys: revert commit
fork me and make a pull request