Github入门与实践css
3.0.8普通用户版account.json跳过登录注册方法已失效,请安装企业版
官网:https://www.sourcetreeapp.com...html
进入 sourcetree 目录, 在资源管理器中进入如下地址node
%LocalAppData%\Atlassian\SourceTree\
放入如下文件 accounts.json
git
[ { "$id": "1", "$type": "SourceTree.Api.Host.Identity.Model.IdentityAccount, SourceTree.Api.Host.Identity", "Authenticate": true, "HostInstance": { "$id": "2", "$type": "SourceTree.Host.Atlassianaccount.AtlassianAccountInstance, SourceTree.Host.AtlassianAccount", "Host": { "$id": "3", "$type": "SourceTree.Host.Atlassianaccount.AtlassianAccountHost, SourceTree.Host.AtlassianAccount", "Id": "atlassian account" }, "BaseUrl": "https://id.atlassian.com/" }, "Credentials": { "$id": "4", "$type": "SourceTree.Model.BasicAuthCredentials, SourceTree.Api.Account", "Username": "", "Email": null }, "IsDefault": false } ]
ssh-keygen -t rsa -C "email@email.com" // 一路回车结束
~/.ssh/id_rsa.pub
,能够用 cat ~/.ssh/id_rsa.pub
查看Header部分只有一行,包括三个字段:type(必需)、scope(可选)和subject(必需)。 type:es6
如下以d3-foo
插件发布为例github
If you’re ready to share your code with the world, make your first commit:docker
git add . git commit
Then create a new repository on GitHub. Add the git remote, and push:npm
git remote add origin git@github.com:{USERNAME}/d3-foo.git git push -u origin master
Replace {USERNAME}
with your GitHub user name and d3-foo with your plugin name, obvs.json
Next, create a git tag that corresponds to the version in your package.json file. (If this is not your first release, you’ll also want to bump the version to 0.0.2, 0.1.0, or 1.0.0 as appropriate.) You can push commits as frequently as you like, but periodically you should bundle these commits together into a release. Tags are simply a mechanism for identifying releases in the repository.segmentfault
git tag -a v0.0.1
(Alternatively, use npm version, which also edits the package.json file for you.)
Push the tag to GitHub:
git push --tags
npm publish
As a side-effect of publishing, NPM will create a d3-foo.zip archive of your release in the build folder. Add this as a custom download to your GitHub releases (for example, see d3-shape) so that people can download your code without needing to use NPM.
Edit your release notes to tell people what’s changed!
Once you’ve published the first time, add your plugin to the wiki. If you want collaborators, let me know, and you can transfer your repository to the D3 organization and setup a team. You’ll retain admin rights and be able to publish new releases as often as you like!
https://jingyan.baidu.com/art...
仓库初始化
git init
查看仓库状态
git status
添加监控跟新文件
git add -A
提交
git commit -m
推送到远程仓库
git push
http://stackoverflow.com/ques...
http://stackoverflow.com/ques...
github中git push origin master出错:error: failed to push some refs to
.DS_Store .sizecache.json /bower_components /dist /node_modules npm-debug.log yarn-error.log
git checkout -b develop //这时候在本地git仓库就建了一个develop分支,git status 会发如今develop分支下 //这时候咱们能够继续编码 //当要push上远程的分支时候须要注意的是,远程尚未develop分支 因此咱们能够 git push origin develop git add . git commit -m "“ git push --set-upstream origin develop
这时候在远程也会发现多了一个develop分支
总结一下 Git 不一样状况下如何回滚
在命令行使用git:
在工做区目录下输入 git reflog
能够查询出每一个历史版本的commit,每一个commit都有对应的ID,
确认好要退回的ID后输入:
git reset --hard 确认的ID
即可退回相应的历史版本
http://chenjsh.cn/demo/demoge...
https://www.atlassian.com/git...
场景是这样的,在一次提交 PR 的 review 过程当中,我提交的一个文件,在若干 commits 的修改下,最终和最初状态彻底相同,可是 PR 中却保留了对该文件的提交历史,所以 reviewer 但愿我能够将这个文件移除提交历史。
这个主要须要用到 git rebase ,步骤以下:
git log filename
: 首先经过 git log 来查询要回滚到的 commit idgit reset commit-id filename
: 对该文件进行 reset 操做(撤销提交历史相关的修改)git checkout filename
: 对其进行 checkout 操做(撤销对文件自己的修改)git commit --amend
: 修改提交历史信息git rebase --continue/git push
: 同步待代码测试没问题,再将本身分支的内容合并到master 分支,而后提交到远程服务
git checkout master git merge <branchname> git push origin master
git支持使用易记的字符串和附加信息为特定的快照打标签。你能够利用标签为开发树
(development tree)加上信息(例如Mergedin new memory management),使其更为清晰,或是标
记出分支上特定的快照。例如,用标签标出release-1分支上的release-1.0和release-1.1。
git支持轻量标签(仅为快照打标签)以及注解标签。
git标签仅在本地范围内有效。 git push 默认不会推送标签。要想把标签发送到origin仓库,
必须加上选项 --tags :
$ git push origin --tags
git tag 命令包括能够用于添加、删除和列出标签的选项。
不使用选项的 git tag 命令能够列出可见标签:
$ git tag release-1.0 release-1.0beta release-1.1
你能够经过添加标签名在当前检出中建立标签:
$ git tag ReleaseCandidate-1
在 gittag 命令中加入指定提交的SHA-1,就能够为该提交添加标签:
$ git log --pretty=oneline bef4a35a67c6228cbeb05913302f96966ff33d01 fix 5bc4812c60222956e5157cc8c9a5f06156a7750b change config 4a8bae2f78c412065c8422821feaa4cc5a94c82b change to es6 36fa4f97a31be4bc410eb0b4e940c753485f1c90 fix: mongo docker 85aa77f7e4c03a3512f75c47f7568aef9f8a757f fix :...skipping... bef4a35a67c6228cbeb05913302f96966ff33d01 fix 5bc4812c60222956e5157cc8c9a5f06156a7750b change config 4a8bae2f78c412065c8422821feaa4cc5a94c82b change to es6 36fa4f97a31be4bc410eb0b4e940c753485f1c90 fix: mongo docker 85aa77f7e4c03a3512f75c47f7568aef9f8a757f fix a3e6f734ad19d33889d2298111cde828147b4c01 node:10 => node:10:...skipping... bef4a35a67c6228cbeb05913302f96966ff33d01 fix 5bc4812c60222956e5157cc8c9a5f06156a7750b change config 4a8bae2f78c412065c8422821feaa4cc5a94c82b change to es6 36fa4f97a31be4bc410eb0b4e940c753485f1c90 fix: mongo docker 85aa77f7e4c03a3512f75c47f7568aef9f8a757f fix a3e6f734ad19d33889d2298111cde828147b4c01 node:10 => node:10.15.3-alpine 200e8e81fb285e8ef035cf51236ad5bedaac8393 feats: add dockerf:...skipping... bef4a35a67c6228cbeb05913302f96966ff33d01 fix 5bc4812c60222956e5157cc8c9a5f06156a7750b change config 4a8bae2f78c412065c8422821feaa4cc5a94c82b change to es6 36fa4f97a31be4bc410eb0b4e940c753485f1c90 fix: mongo docker 85aa77f7e4c03a3512f75c47f7568aef9f8a757f fix a3e6f734ad19d33889d2298111cde828147b4c01 node:10 => node:10.15.3-alpine 200e8e81fb285e8ef035cf51236ad5bedaac8393 feats: add dockerfile :...skipping... bef4a35a67c6228cbeb05913302f96966ff33d01 fix 5bc4812c60222956e5157cc8c9a5f06156a7750b change config 4a8bae2f78c412065c8422821feaa4cc5a94c82b change to es6 36fa4f97a31be4bc410eb0b4e940c753485f1c90 fix: mongo docker 85aa77f7e4c03a3512f75c47f7568aef9f8a757f fix a3e6f734ad19d33889d2298111cde828147b4c01 node:10 => node:10.15.3-alpine 200e8e81fb285e8ef035cf51236ad5bedaac8393 feats: add dockerfile 2913f6ec026931ab2b189da91f10e0a43d1fee5e 添加readme dcded2b55f7fd190a1cc8aee2aa5e6b1e50886bd jx_todo_app firstversion
# $ git tag menuComplete ad606b git tag v1.0.1 bef4a35a67
选项 -a 能够为标签加入注解:
$ git tag -a tagWithExplanation
你能够在命令行中使用 -m 选项定义信息:
$ git tag -a tagWithShortMessage -m "A short description"
若是使用 git show 命令,会显示以下信息:
$ git show tagWithShortMessage tag tagWithShortmessage Tagger: Clif Flynt <clif@cflynt.com> Date: Fri Dec 23 09:58:19 2016 -0500 6 A short description ...
选项 -d 能够删除标签:
$ git tag tag1 tag2 tag3 $ git tag -d tag2 $ git tag tag2 tag3F
git branch -D `git branch`| grep -E 'fix-*'
git stash
(git储藏)可用于如下情形:
git stash
会把全部未提交的修改(包括暂存的和非暂存的)都保存起来,用于后续恢复当前工做目录。
好比下面的中间状态,经过git stash
命令推送一个新的储藏,当前的工做目录就干净了。
$ git status On branch master Changes to be committed: new file: style.css Changes not staged for commit: modified: index.html $ git stash Saved working directory and index state WIP on master: 5002d47 our new homepage HEAD is now at 5002d47 our new homepage $ git status On branch master nothing to commit, working tree clean
须要说明一点,stash是本地的,不会经过git push命令上传到git server上。
实际应用中推荐给每一个stash加一个message,用于记录版本,使用git stash save取代git stash命令。示例以下:
$ git stash save "test-cmd-stash" Saved working directory and index state On autoswitch: test-cmd-stash HEAD 如今位于 296e8d4 remove unnecessary postion reset in onResume function $ git stash list stash@{0}: On autoswitch: test-cmd-stash
能够经过git stash pop
命令恢复以前缓存的工做目录,输出以下:
$ git status On branch master nothing to commit, working tree clean $ git stash pop On branch master Changes to be committed: new file: style.css Changes not staged for commit: modified: index.html Dropped refs/stash@{0} (32b3aa1d185dfe6d57b3c3cc3b32cbf3e380cc6a)
这个指令将缓存堆栈中的第一个stash删除,并将对应修改应用到当前的工做目录下。
你也可使用git stash apply命令,将缓存堆栈中的stash屡次应用到工做目录中,但并不删除stash拷贝。命令输出以下:
$ git stash apply On branch master Changes to be committed: new file: style.css Changes not staged for commit: modified: index.html
可使用git stash list命令,一个典型的输出以下:
$ git stash list stash@{0}: WIP on master: 049d078 added the index file stash@{1}: WIP on master: c264051 Revert "added file_size" stash@{2}: WIP on master: 21d80a5 added number to log
在使用git stash apply命令时能够经过名字指定使用哪一个stash,默认使用最近的stash(即stash@{0})
可使用git stash drop命令,后面能够跟着stash名字。下面是一个示例:
$ git stash list stash@{0}: WIP on master: 049d078 added the index file stash@{1}: WIP on master: c264051 Revert "added file_size" stash@{2}: WIP on master: 21d80a5 added number to log $ git stash drop stash@{0} Dropped stash@{0} (364e91f3f268f0900bc3ee613f9f733e82aaed43)
或者使用git stash clear命令,删除全部缓存的stash。
git 教程
Githug 通关攻略
沉浸式学 Git
git建立本地分支以及推送本地分之至远程分支
https://segmentfault.com/a/11...
git commit 规范指南
git 技巧
git-stash用法小结