mirror of
https://github.com/namibia/tips.git
synced 2024-12-22 10:08:58 +00:00
Migrated to doxie ❤️
This commit is contained in:
parent
dd2031c387
commit
eff7432b3a
19
.doxie.render.js
Normal file
19
.doxie.render.js
Normal file
@ -0,0 +1,19 @@
|
||||
function escapeStr(str) {
|
||||
return str
|
||||
.replace(/\"/g, '\\"')
|
||||
.replace(/\n/g, '\\n');
|
||||
}
|
||||
|
||||
var render = function(data) {
|
||||
var data = data.data;
|
||||
|
||||
return [
|
||||
'## ' + data.title,
|
||||
'```sh',
|
||||
data.tip,
|
||||
'```',
|
||||
'\n'
|
||||
].join('\n');
|
||||
};
|
||||
|
||||
module.exports = render;
|
12
.doxie.render.toc.js
Normal file
12
.doxie.render.toc.js
Normal file
@ -0,0 +1,12 @@
|
||||
var tips = require('./tips.json');
|
||||
|
||||
var render = function(data) {
|
||||
var data = data.data;
|
||||
|
||||
var out = '* [' + data.title + '](https://github.com/git-tips/tips#' + data.title + ')\n';
|
||||
|
||||
if (tips[tips.length -1].title === data.title) out = out + '\n';
|
||||
return out;
|
||||
};
|
||||
|
||||
module.exports = render;
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
npm-debug.log
|
39
README.md
39
README.md
@ -1,54 +1,65 @@
|
||||
## Overwrite pull
|
||||
<!-- @doxie.inject start toc -->
|
||||
<!-- Don’t remove or change the comment above – that can break automatic updates. -->
|
||||
* [Overwrite pull](https://github.com/git-tips/tips#Overwrite pull)
|
||||
* [List of all the files changed in a commit](https://github.com/git-tips/tips#List of all the files changed in a commit)
|
||||
* [Git reset first commit](https://github.com/git-tips/tips#Git reset first commit)
|
||||
* [List all the conflicted files](https://github.com/git-tips/tips#List all the conflicted files)
|
||||
* [List all branches that are already merged into master](https://github.com/git-tips/tips#List all branches that are already merged into master)
|
||||
* [Quickly switch to the previous branch](https://github.com/git-tips/tips#Quickly switch to the previous branch)
|
||||
* [Remove branches that have already been merged with master](https://github.com/git-tips/tips#Remove branches that have already been merged with master)
|
||||
* [List all branches and their upstreams, as well as last commit on branch](https://github.com/git-tips/tips#List all branches and their upstreams, as well as last commit on branch)
|
||||
* [Track upstream branch](https://github.com/git-tips/tips#Track upstream branch)
|
||||
|
||||
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
|
||||
<!-- @doxie.inject end toc -->
|
||||
|
||||
|
||||
<!-- @doxie.inject start -->
|
||||
<!-- Don’t remove or change the comment above – that can break automatic updates. -->
|
||||
## Overwrite pull
|
||||
```sh
|
||||
git fetch --all
|
||||
git reset --hard origin/master
|
||||
git fetch --all && git reset --hard origin/master
|
||||
```
|
||||
|
||||
## List of all the files changed in a commit
|
||||
|
||||
```sh
|
||||
git ls-tree --name-only -r <commit-ish>
|
||||
```
|
||||
|
||||
## Git reset first commit
|
||||
|
||||
```sh
|
||||
git update-ref -d HEAD
|
||||
```
|
||||
|
||||
## List all the conflicted files
|
||||
|
||||
```sh
|
||||
git diff --name-only --diff-filter=U
|
||||
```
|
||||
|
||||
## List all branches that are already merged into master
|
||||
|
||||
```sh
|
||||
git checkout master
|
||||
git branch --merged
|
||||
git checkout master && git branch --merged
|
||||
```
|
||||
|
||||
## Quickly switch to the previous branch
|
||||
|
||||
```sh
|
||||
git checkout -
|
||||
```
|
||||
|
||||
# Remove branches that have already been merged with master
|
||||
## Remove branches that have already been merged with master
|
||||
```sh
|
||||
git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d
|
||||
git branch --merged | grep -v '\*' | xargs -n 1 git branch -d
|
||||
```
|
||||
|
||||
## List all branches and their upstreams, as well as last commit on branch
|
||||
|
||||
```sh
|
||||
git branch -vv
|
||||
```
|
||||
|
||||
## Track upstream branch
|
||||
|
||||
```sh
|
||||
git branch -u origin/mybranch
|
||||
```
|
||||
|
||||
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->
|
||||
<!-- @doxie.inject end -->
|
||||
|
37
package.json
Normal file
37
package.json
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "tips",
|
||||
"version": "1.0.0",
|
||||
"description": "collection of git tips",
|
||||
"main": "index.js",
|
||||
"private": "true",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"precommit": "npm run generate && git add README.md",
|
||||
"update-readme": "echo 'Updating the readme…'; doxie --render < ./tips.json --inject into README.md && echo '…done!'",
|
||||
"update-toc": "echo 'Updating the table of contents…'; doxie --render .doxie.render.toc.js < ./tips.json --inject into README.md as toc && echo '…done!'",
|
||||
"generate": "npm run update-readme; npm run update-toc"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/npm-tips/tips.git"
|
||||
},
|
||||
"keywords": [
|
||||
"npm",
|
||||
"tips"
|
||||
],
|
||||
"contributors": [
|
||||
"hemanth"
|
||||
],
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/git-tips/tips/issues"
|
||||
},
|
||||
"homepage": "https://github.com/git-tips/tips#readme",
|
||||
"devDependencies": {
|
||||
"doxie": "^0.2.2",
|
||||
"doxie.inject": "^0.1.1",
|
||||
"doxie.output": "^0.3.0",
|
||||
"doxie.render": "^0.3.0",
|
||||
"husky": "^0.8.1"
|
||||
}
|
||||
}
|
38
tips.json
Normal file
38
tips.json
Normal file
@ -0,0 +1,38 @@
|
||||
[
|
||||
{
|
||||
"title": "Overwrite pull",
|
||||
"tip": "git fetch --all && git reset --hard origin/master"
|
||||
},
|
||||
{
|
||||
"title": "List of all the files changed in a commit",
|
||||
"tip": "git ls-tree --name-only -r <commit-ish>"
|
||||
},
|
||||
{
|
||||
"title": "Git reset first commit",
|
||||
"tip": "git update-ref -d HEAD"
|
||||
},
|
||||
{
|
||||
"title": "List all the conflicted files",
|
||||
"tip": "git diff --name-only --diff-filter=U"
|
||||
},
|
||||
{
|
||||
"title": "List all branches that are already merged into master",
|
||||
"tip": "git checkout master && git branch --merged"
|
||||
},
|
||||
{
|
||||
"title": "Quickly switch to the previous branch",
|
||||
"tip": "git checkout -"
|
||||
},
|
||||
{
|
||||
"title": "Remove branches that have already been merged with master",
|
||||
"tip": "git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
|
||||
},
|
||||
{
|
||||
"title": "List all branches and their upstreams, as well as last commit on branch",
|
||||
"tip": "git branch -vv"
|
||||
},
|
||||
{
|
||||
"title": "Track upstream branch",
|
||||
"tip": "git branch -u origin/mybranch"
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue
Block a user