mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-22 01:02:09 +02:00
Updating the git page
This page might seem slightly big for a project called tl;dr, but git has tons of commonly used options and I've kept all descriptions as short but meaningful as possible (within 80 characters)
This commit is contained in:
parent
660fb0958e
commit
9891588789
1 changed files with 72 additions and 0 deletions
|
@ -2,6 +2,78 @@
|
||||||
|
|
||||||
> Main command for all `git` commands
|
> Main command for all `git` commands
|
||||||
|
|
||||||
|
- Create a new local repository
|
||||||
|
|
||||||
|
`git init`
|
||||||
|
|
||||||
|
- Show changed files which are not yet added for commit
|
||||||
|
|
||||||
|
`git status`
|
||||||
|
|
||||||
|
- Show changes to tracked files
|
||||||
|
|
||||||
|
`git diff`
|
||||||
|
|
||||||
|
- Add all current changes to the next commit
|
||||||
|
|
||||||
|
`git add .`
|
||||||
|
|
||||||
|
- Commit staged files to the repository with comment
|
||||||
|
|
||||||
|
`git commit -am "Commit message"`
|
||||||
|
|
||||||
|
- Replace the last commit with currently staged changes
|
||||||
|
|
||||||
|
`git commit --amend`
|
||||||
|
|
||||||
|
- Show all commits
|
||||||
|
|
||||||
|
`git log`
|
||||||
|
|
||||||
|
- Show what revision and author last modified each line of a file
|
||||||
|
|
||||||
|
`git blame {{file}}`
|
||||||
|
|
||||||
|
- Clone an existing repository
|
||||||
|
|
||||||
|
`git clone {{remote-repository-location}}`
|
||||||
|
|
||||||
|
- List all existing branches
|
||||||
|
|
||||||
|
`git branch`
|
||||||
|
|
||||||
|
- Create new branch based on current branch
|
||||||
|
|
||||||
|
`git branch {{new-branch}}`
|
||||||
|
|
||||||
|
- Switch to another branch
|
||||||
|
|
||||||
|
`git checkout {{another-branch}}`
|
||||||
|
|
||||||
|
- Delete a local branch
|
||||||
|
|
||||||
|
`git branch -d {{branch-name}}`
|
||||||
|
|
||||||
|
- Download repository from remote location and merge with current local branch
|
||||||
|
|
||||||
|
`git pull {{remote-repository}} {{local-branch}}`
|
||||||
|
|
||||||
|
- Publish local changes on a remote location
|
||||||
|
|
||||||
|
`git push {{remote-repository}} {{local-branch}}`
|
||||||
|
|
||||||
|
- Merge a branch with your current HEAD branch
|
||||||
|
|
||||||
|
`git merge {{branch-name}}`
|
||||||
|
|
||||||
|
- Reset current HEAD to the previous commit and preserve all unstaged changes
|
||||||
|
|
||||||
|
`git reset {{commit}}`
|
||||||
|
|
||||||
|
- Discard all local uncommitted changes
|
||||||
|
|
||||||
|
`git reset --hard HEAD`
|
||||||
|
|
||||||
- Checking git version
|
- Checking git version
|
||||||
|
|
||||||
`git --version`
|
`git --version`
|
||||||
|
|
Loading…
Add table
Reference in a new issue