mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-23 08:16:16 -04:00
feat(tool): git memo
This commit is contained in:
parent
889d594992
commit
5cd9997a84
11 changed files with 504 additions and 18 deletions
77
src/tools/git-memo/git-memo.md
Normal file
77
src/tools/git-memo/git-memo.md
Normal file
|
@ -0,0 +1,77 @@
|
|||
## Configuration
|
||||
|
||||
Set the global config
|
||||
|
||||
```shell
|
||||
git config --global user.name "[name]"
|
||||
git config --global user.email "[email]"
|
||||
```
|
||||
|
||||
## Get started
|
||||
|
||||
Create a git repository
|
||||
|
||||
```shell
|
||||
git init
|
||||
```
|
||||
|
||||
Clone an existing git repository
|
||||
|
||||
```shell
|
||||
git clone [url]
|
||||
```
|
||||
|
||||
## Commit
|
||||
|
||||
Commit all tracked changes
|
||||
|
||||
```shell
|
||||
git commit -am "[commit message]"
|
||||
```
|
||||
|
||||
Add new modifications to the last commit
|
||||
|
||||
```shell
|
||||
git commit --amend --no-edit
|
||||
```
|
||||
|
||||
## I’ve made a mistake
|
||||
|
||||
Change last commit message
|
||||
|
||||
```shell
|
||||
git commit --amend
|
||||
```
|
||||
|
||||
Undo most recent commit and keep changes
|
||||
|
||||
```shell
|
||||
git reset HEAD~1
|
||||
```
|
||||
|
||||
Undo the `N` most recent commit and keep changes
|
||||
|
||||
```shell
|
||||
git reset HEAD~N
|
||||
```
|
||||
|
||||
Undo most recent commit and get rid of changes
|
||||
|
||||
```shell
|
||||
git reset HEAD~1 --hard
|
||||
```
|
||||
|
||||
Reset branch to remote state
|
||||
|
||||
```shell
|
||||
git fetch origin
|
||||
git reset --hard origin/[branch-name]
|
||||
```
|
||||
|
||||
## Miscellaneous
|
||||
|
||||
Renaming the local master branch to main
|
||||
|
||||
```shell
|
||||
git branch -m master main
|
||||
```
|
21
src/tools/git-memo/git-memo.vue
Normal file
21
src/tools/git-memo/git-memo.vue
Normal file
|
@ -0,0 +1,21 @@
|
|||
<template>
|
||||
<div>
|
||||
<memo />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Memo from './git-memo.md'
|
||||
import { useThemeVars } from 'naive-ui'
|
||||
|
||||
const themeVars = useThemeVars()
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
::v-deep(pre) {
|
||||
margin: 0;
|
||||
padding: 15px 22px;
|
||||
background-color: v-bind('themeVars.cardColor');
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
11
src/tools/git-memo/index.ts
Normal file
11
src/tools/git-memo/index.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { BrandGit } from '@vicons/tabler';
|
||||
import type { ITool } from '../Tool';
|
||||
|
||||
export const tool: ITool = {
|
||||
name: 'Git cheatsheet',
|
||||
path: '/git-memo',
|
||||
description: 'Git is a decentralized version management sofware. With this cheatsheet you will have a quick acces to the most common git commands.',
|
||||
keywords: ['git', 'push', 'force', 'pull', 'commit', 'ammend', 'rebase', 'merge', 'reset', 'soft', 'hard', 'lease'],
|
||||
component: () => import('./git-memo.vue'),
|
||||
icon: BrandGit,
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue