.
your @ mail. com Yoursurname
gitconfig --global user.email " [email protected] "
gitconfig --global user.name " Your surname "
gitconfig --global core.autocrlf true
gitconfig --global core.safecrlf true
mkdir -p C:/students/git_test
cdC:/students/git_test
gitinit
// hello.html :
touchhello.html
// C:\Users\Public\git_test
// hello.html .
C .
: HELLO. HTML
Hello, World
:
git status
:
On branch masterUntracked files: (use "git add <file>..." to include in what will be committed) hello.htmlnothing added to commit but untracked files present (use "git add" to track)
( )
git add hello.html
git status
:
On branch masterChanges to be committed: (use "git reset HEAD <file>..." to unstage) new file: hello.html
git commit -m "first commit"
:
[master (root-commit) 911e8c9] first Commit 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 hello.html
// hello.html , surname . C .:
: HELLO.HTML
< h 1> Hello, surname! </ h 1>
gitaddhello.html
gitcommit hello.html , -m, . commit .
gitcommit -m "addedtagh1"
git , , , , git , , .
, (a.html, b.html, and c.html). , a.html b.html , c.html .
// a.html, b.html, c.html:
touch a.html
touch b.html
touchc.html
gitstatus
//
|
|
git add a.html
git add b.html
git commit -m "Changes for a and b"
gitstatus
//
gitaddc.html
git commit -m "Unrelated change to c"
gitstatus
gitlog
git log --pretty=oneline
:
fa3c1411aa09441695a9e645d4371e8d749da1dc Unrelated change to c8c3228730ed03116815a5cc682e8105e7d981928 Changes for a and b43628f779cb333dd30d78186499f93638107f70b Added h1 tag911e8c91caeab8d30ad16d56746cbd6eef72dc4c First Commit
<>< >. .
. checkout .
// hello.html
cathello.html
// , < hash > FirstCommit. gitlog --pretty=oneline. 5 . : fa3c1411aa09441695a9e645d4371e8d749da1dcfa3c1
gitcheckout <hash> //: gitcheckoutfa3c1
// hello.html
cathello.html
cat hello.html , hello. html. a. html, b. html, c. html.
// . master- .
gitcheckoutmaster
( )
// hello.html . C .:.
: HELLO.HTML
<h1>Hello, World!</h1> <!-- -->
gitstatus
cathello.html
//
git checkout hello.html
cat hello.html
, , . hello. html .
( )
// hello.html . C .:.
: HELLO.HTML
<h1>Hello, World!</h1> <!-- , -->
//
gitaddhello.html
//
gitstatus
//
cathello.html
//
gitresetHEADhello.html
//
gitstatus
//
gitcheckouthello.html
//
cathello.html
reset HEAD(HEAD , ). , .
|
|
// hello.html . C .:.
: HELLO.HTML
<h1>Hello, World!</h1> <!-- , .-->
//
gitaddhello.html
//
git commit -m "Oops, we didn't want this commit"
//
git log --pretty=oneline
// hello.html
cathello.html
// ,
git revert HEAD --no-edit
//
git log --pretty=oneline
// hello.html
cathello.html
helloworld . , , master. , , - . master.
// test
gitbranchtest
//
gitcheckouttest
// hello.html.
C .:.
: HELLO.HTML
<html><body> <i>Hello, World!</i></body></html>
git add hello.html
git commit -m "Added standard HTML page tags, i tag"
// master
gitcheckoutmaster
// hello.html.
C .:.
: HELLO.HTML
<b>Hello, World!</b>
git add hello.html
git commit -m "b tag"
.
gitmergetest
git . , , gitc . . .
:
$ gitmerge testAuto-merging hello.htmlCONFLICT (content): Merge conflict in hello.htmlAutomatic merge failed; fix conflicts and then commit the result.
// hello.html
: LIB/HELLO.HTML
<<<<<<< HEAD <b> Hello,World! </b> =======<html><body> <i> Hello,World! </i> </body></html>>>>>>>>test
// hello.html .
C .:.
: LIB/HELLO.HTML
<html><body> <i><b> Hello, World </b></i> </body></html>
//
gitaddhello.html
//
git commit -m "Merged test fixed conflict."
:
GitGui
Open Existing Repository << C:/students/git_test
Repository-> Visualize All Branch History
:
1. .
. :
2. (. 4!)GitGui-> Repository-> Visualize All Branch History
.
3. :
git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short
Git () GitBash
cd C:\students\git_test
git log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short
|
|
:
* c7ffde0 2015-10-21 | Merged test fixed conflict. (HEAD -> master) [lesnov]
|\
| * 17bd00a 2015-10-21 | Added standard HTML page tags, i tag (test) [lesnov]
* | 817cb80 2015-10-21 | b tag [lesnov]
|/
* 58b8995 2015-10-21 | Revert "Oops, we didn't want this commit" [lesnov]
* 911b4d7 2015-10-21 | Oops, we didn't want this commit [lesnov]
* e2d5bbe 2015-10-21 | Unrelated change to c [lesnov]
* 7b0a6f1 2015-10-21 | Changes for a and b [lesnov]
* 1b7ecaa 2015-10-21 | added tag h1 [lesnov]
* 4771515 2015-10-21 | firstcommit [lesnov]