jkhhuse / blog Goto Github PK
View Code? Open in Web Editor NEWrecords from my coding
License: Apache License 2.0
records from my coding
License: Apache License 2.0
安装完成后创建账户
$ git config --global user.name "Your Name"
$ git config --global user.email "[email protected]"
可以通过如下命令查看git的配置
$ git status
$ cd dir
$ mkdir repo
$ git init
会在repo目录下生成一个.git文件,用于跟踪/管理版本库。
$ touch readme.txt
$ git add readme.txt
$ git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: readme.txt
new file: user git/status.jpg
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: readme.txt
$ git commit -m "append"
[master (root-commit) 1e57831] append
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 readme.txt
create mode 100644 user git/status.jpg
使用git log命令可以看到提交的日志
新建一个文件,未添加前状态为“Untracked”,即未被Git版本追踪:
$ git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
readme.txt
nothing added to commit but untracked files present (use "git add" to track)
添加文件
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: readme.txt
commit一个文件:
jk@jk-pc /cygdrive/e/learn/git/img
$ git status
On branch master
nothing to commit, working tree clean
通过git log查看提交记录
$ git log
commit 1e5783173a17ea5fc2cd9849cfa74214ef2da4e8
Author: name <[email protected]>
Date: Mon Mar 27 04:57:05 2017 +0100
append
使用reset命令,回退版本
$ git reset --hard 1e5783173a17ea5fc2cd9849cfa74214ef2da4e8
$ git checkout -- readme.txt
$ git rm readme.txt
i) 生成ken-gen
$ ssh-keygen -t rsa -C "[email protected]"
window下把生成的私钥(id_rsa)与公钥(id_rsa.pub)拷贝到cygwin目录下:
cp /C/Users/user_name/.ssh/* /home/user_name/.ssh/
ii) 配置GitHub SSH Keys
拷贝公钥到->GitHub->Account->Settings->SSH Keys
i) 本地创建仓库
$ mkdir repo
$ cd repo
$ git init
$ touch readme.txt
$ git add readme.txt
$ git commit -m "test"
ii) 创建远程仓库
在Github中创建一个同名仓库
iii) 把本地仓库内容推送到远程仓库
$ git remote add origin [email protected]:jkhhuse/repo.git
iv) 把本地仓库内容推送到远程仓库
$ git push -u origin master
加上了-u参数,Git不但会把本地的master分支内容推送的远程新的master分支,
还会把本地的master分支和远程的master分支关联起来,在以后的推送或者拉取时就可以简化命令。
$ git clone [email protected]:jkhhuse/repo.git
i) 创建分支
$ git checkout -b dev
#相当于
$ git branch dev #创建分支
$ git checkout dev #切换到dev分支
ii) 查看分支
$ git branch
* dev
master
*表示当前操作的branch
iii) 合并分支
切换到master后,合并dev分支
$ git checkout master
$ git merge dev
iv) 删除分支
除非需要将分支推送到远程仓库,否则分支就是个人所见的。
$ git branch -d dev
v) 查看分支
$ git branch
$ git pull
如果出现冲突则,可以使用diff命令查看差异。
git diff <source_branch> <target_branch>
在merge过程中,出现的冲突时:
$ git merge feature1
error: Merging is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
Git用<<<<<<<,=======,>>>>>>>标记出不同分支的内容:
<<<<<<< HEAD
Creating a new branch is quick & simple.
=======
Creating a new branch is quick AND simple.
>>>>>>> feature1
修改出现冲突的文件,重新add并commit。
使用git log命令可以看到分支并不的情况:
$ git log --graph --pretty=oneline --abbrev-commit
* 59bc1cb conflict fixed
|\
| * 75a857c AND simple
* | 400b400 & simple
|/
* fec145a branch test
最后删除分支
i) 切换到需要打tag的分支:
$ git branch
$ git checkout master
ii) 使用tag命令打tag:
$ git tag v1.0
iii) 使用tag查看所有tag:
$ git tag
iv) 对历史commit打tag:
$ git log --pretty=oneline --abbrev-commit
$ git tag v0.9 id前10个字符
v) 设置tag的说明:
$ git tag -a v0.1 -m "version 0.1 released" 3628164
vi) 删除tag:
$ git tag -d v0.1
vii) 推送tag到远程:
例如需要把本地的tag推送到github中:
git push origin v1.0
那么在github项目的release中就会出现刚刚推送的tag。
也可以一次性推送全部的tag:
$ git push origin --tags
如果需要删除远程tag,那么需要先删除本地tag,然后push到远程来删除远程仓库中的bug:
$ git tag -d v1.0
$ git push origin :refs/tags/v1.0
Git tutorial: https://lvwzhen.gitbooks.io/git-tutorial
git - 简明指南: http://rogerdudler.github.io/git-guide/index.zh.html
netstat -apn | grep <端口号>
ps -aux | grep <进程号>
使用Ctrl + Shift + P install Package分别安装以下插件
{
"posix": {
"linux": {
"firefox": "firefox -new-tab",
"chrome": "google-chrome",
"chrome64": "google-chrome",
"chromium": "chromium"
"linux2": {
"firefox": "firefox -new-tab",
"chrome": "google-chrome",
"chrome64": "google-chrome",
"chromium": "chromium"
},
"darwin": {
"firefox": "open -a \"/Applications/Firefox.app\"",
"safari": "open -a \"/Applications/Safari.app\"",
"chrome": "open -a \"/Applications/Google Chrome.app\"",
"chrome64": "open -a \"/Applications/Google Chrome.app\"",
"yandex": "open -a \"/Applications/Yandex.app\""
}
},
"nt": {
"win32": {
"firefox": "F:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe -new-tab",
"iexplore": "F:\\Program Files\\Internet Explorer\\iexplore.exe",
"chrome": "F:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
"chrome64": "F:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
"yandex": "%Local AppData%\\Yandex\\YandexBrowser\\browser.exe"
}
},
"browser": "chrome64"
}
{
"draw_centered": true,
"word_wrap": true,
"wrap_width": 210,
"rulers": [],
"color_scheme": "Packages/MarkdownEditing/MarkdownEditor-Dark.tmTheme",
}
{
"auto_save_delay_in_seconds": 1,
}
使用Ctrl + N新建一个文件
在正文中输入文字
Ctrl + Shift + P 输入ssm(set syntax: markdown)
Ctrl + S 保存为mdown文件
[
{"keys": ["alt+m"], "command": "markdown_preview", "args": { "target": "browser"}}
]
通过以上设置,可以实现定时保存markwodn文件,并同步刷新在浏览器端的效果。
问题:angularJs列表中点击某条记录,跳转到新页面。当返回到列表后,仍然可以回到跳转前的页码处。
要做到上述效果,要把分页中的currentPage填写到url中,然后在新页面的url中也添加这个page信息。
$routeParams.page 获得url中的page
$route.updateParams({page:$scope.page}) 修改url中的page信息
$routeProvider.when('/demo/:page',{
...
}) 路由写法
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.