View
562
Download
0
Embed Size (px)
Basic
Commands
insanehong@KGUG2014. 12. 20
NAVER / NAVER LABS
twitter: @insanehong
email : insanehong@gmail.com
http://about.me/insanehong
insanehong.talk.start(Hi! Bro!)
https://www.flickr.com/photos/miguelpdl/4994396370
&
! .
http://www.dailycal.org/2013/11/21/everybody-macbook/
Why do programmers use or recommend
macs or linux?
http://www.dailycal.org/2013/11/21/everybody-macbook/
! .
& CLIGUIRecommend
NAVER give up!!e
.
photo by https://www.flickr.com/photos/slworking/
Try git better, together
A .
recruiting@a.com github url
.
Great a Git repository
git init This command creates an empty git repository
- https://www.kernel.org/pub/software/scm/git/docs/git-init.html -
git
$> git init
$> git init
/workspace
$> git init git-study && cd git-study Initialized empty Git repository /workspace/git-study/.git/
/git-study.git
/git-study.git
Repository Structure
Working tree
index (Staging area)
object database
Working area
Cache storage Storage
Working tree
index (Staging area)
object database
git add git commit
!
What is commit?
In computer science and data management, a commit is the making of a set of tentative
changes permanent.- http://en.wikipedia.org/wiki/Commit_(data_management) -
Git ?
Git commit !
Untracked Staged Committed Modified
Tracked
git add git commit edit file
git add
file
Be committed to doing
/git-study.gitcompress.js
http://git.io/Tq59Hw
Working tree
index (Staging area)
object database
git add git commit
git add This command updates the index using
the current content found in the working tree, to prepare the content staged for the next commit
- https://www.kernel.org/pub/software/scm/git/docs/git-add.html -
working directory
$> git add
$> git add -a
Two!
?
git status Displays paths that have differences between the index
file and the current HEAD commit, and paths in the working tree that are not tracked by git
- https://www.kernel.org/pub/software/scm/git/docs/git-status.html -
Woking directory .
$> git status
$> git status -s
$> git status On branch master
Initial commit
Untracked files: (use "git add ..." to include in what will be committed)
compress.js
nothing added to commit but untracked files present (use "git add" to track)
$> git status -s ?? compress.js
/git-study.gitcompress.js
$> git add compress.js $> git status On branch master
Initial commit
Changes to be committed: (use "git rm --cached ..." to unstage)
new file: compress.js
$> git status -s A compress.js
Working tree
index (Staging area)
object database
git add git commit
git commit Stores the current contents of the index in a
new commit along with a log message from the user describing the changes.
- https://www.kernel.org/pub/software/scm/git/docs/git-commit.html -
/git-study.gitcompress.js
$> git commit -m [master (root-commit) 5525f5f] 1 file changed, 28 insertions(+) create mode 100644 compress.js
$> git status On branch master nothing to commit, working directory clean
5525f5f
compress.js
function compress(str) { var repeat = 1; var result = str.charAt(0); var prev = result;
for( var i =1; i < str.length; i++ ) {
if( str.charAt(i) === prev ) { repeat++; } else { if (repeat > 1) result += repeat; result += str.charAt(i); repeat = 1; }
prev = str.charAt(i);
}
console.log(str, ' > ', result);
}
var test1 = "hello world, hello git"; var test2 = "helloooooooo";
compress(test1); compress(test2);
Untracked
compress.js
function compress(str) { var repeat = 1; var result = str.charAt(0); var prev = result;
for( var i =1; i < str.length; i++ ) {
if( str.charAt(i) === prev ) { repeat++; } else { if (repeat > 1) result += repeat; result += str.charAt(i); repeat = 1; }
prev = str.charAt(i);
}
console.log(str, ' > ', result);
}
var test1 = "hello world, hello git"; var test2 = "helloooooooo";
compress(test1); compress(test2);
compress.js
function compress(str) { var repeat = 1; var result = str.charAt(0); var prev = result;
for( var i =1; i < str.length; i++ ) {
if( str.charAt(i) === prev ) { repeat++; } else { if (repeat > 1) result += repeat; result += str.charAt(i); repeat = 1; }
prev = str.charAt(i);
}
console.log(str, ' > ', result);
}
var test1 = "hello world, hello git"; var test2 = "helloooooooo";
compress(test1); compress(test2);
blobfunction compress(str) { var repeat = 1; var result = str.charAt(0); var prev = result;
81b90e8
Staged
compress.js
function compress(str) { var repeat = 1; var result = str.charAt(0); var prev = result;
for( var i =1; i < str.length; i++ ) {
if( str.charAt(i) === prev ) { repeat++; } else { if (repeat > 1) result += repeat; result += str.charAt(i); repeat = 1; }
prev = str.charAt(i);
}
console.log(str, ' > ', result);
}
var test1 = "hello world, hello git"; var test2 = "helloooooooo";
compress(test1); compress(test2);
compress.js
function compress(str) { var repeat = 1; var result = str.charAt(0); var prev = result;
for( var i =1; i < str.length; i++ ) {
if( str.charAt(i) === prev ) { repeat++; } else { if (repeat > 1) result += repeat; result += str.charAt(i); repeat = 1; }
prev = str.charAt(i);
}
console.log(str, ' > ', result);
}
var test1 = "hello world, hello git"; var test2 = "helloooooooo";
compress(test1); compress(test2);
blobfunction compress(str) { var repeat = 1; var result = str.charAt(0); var prev = result;
tree
81b90e8
3cfa7a2
compress.js 81b90e8
commit 5525f5f
tree 3cfa7a2
author insnae 1330482646 +0900
commiter insnae 1330482646 +0900
Commited
?
$> node compress hello world, hello git > hel2o world, hel2o git helloooooooo > hel2o
!
https://www.flickr.com/photos/slworking/8739080572
?
helloooooooo> hel2o
currently
helloooooooo> hel2o8
Goals
8 if( str.charAt(i) === prev ) { 9 repeat++; 10 if ( i === str.length -1) result+=repeat; 11 } else {
Solution
8 if( str.charAt(i) === prev ) { 9 repeat++; 10 if ( i === str.length - 1 ) result += repeat; 11 } else {
header 1 /* 2 Author insanehong 3 LICENSE under BSD 4 */
git diff Show changes between the working tree and
the index or a tree, changes between the index and a tree, changes between two trees, or changes
between two files on disk..- https://www.kernel.org/pub/software/scm/git/docs/git-diff.html -
working directory index $> git diff
$> git diff ..
index HEAD $> git diff --staged
/git-study.gitcompress.js
$> git diff diff --git a/compress.js b/compress.js index 81b90e8..46c3d6e 100644 --- a/compress.js +++ b/compress.js @@ -7,6 +7,7 @@ function compress(str) {
if( str.charAt(i) === prev ) { repeat++; + if ( i === str.length -1) result+=repeat; } else { if (repeat > 1) result+=repeat; result+=str.charAt(i);
5525f5f
/git-study.gitcompress.js
$> git add compress.js $> git status -s M compress.js
$> git commit -m [master f5cd615] 1 file changed, 1 insertion(+)
5525f5f
f5cd615
compress.js
function compress(str) { var repeat = 1; var result = str.charAt(0); var prev = result;
for( var i =1; i < str.length; i++ ) {
if( str.charAt(i) === prev ) { repeat++; if ( i === str.length - 1 ) result += repeat;
} else { if (repeat > 1) result += repeat; result += str.charAt(i); repeat = 1; }
prev = str.charAt(i);
}
console.log(str, ' > ', result);
}
var test1 = "hello world, hello git"; var test2 = "helloooooooo";
compress(test1); compress(test2);
compress.js
function compress(str) { var repeat = 1; var result = str.charAt(0); var prev = result;
for( var i =1; i < str.length; i++ ) {
if( str.charAt(i) === prev ) { repeat++; } else { if (repeat > 1) result += repeat; result += str.charAt(i);