Browse Source

split git commands

kxy 11 years ago
parent
commit
4d70294f06

+ 16 - 0
pages/common/git-add.md

@@ -0,0 +1,16 @@
+#git add
+
+> Adds changed files to the index
+
+- Add a file to the index
+
+`git add {{PATHSPEC}}`
+
+- Add all current changes to the index
+
+`git add .`
+
+- Also add ignored files
+
+`git add -f`
+

+ 19 - 0
pages/common/git-branch.md

@@ -0,0 +1,19 @@
+#git branch
+
+> Main command for working with branches
+
+- List all existing branches
+
+`git branch`
+
+- Create new branch based on current branch
+
+`git branch {{BRANCH-NAME}}
+
+- Delete a local branch
+
+`git branch -d {{BRANCH-NAME}}`
+
+- Move/Rename a branch
+
+`git branch -m`

+ 11 - 0
pages/common/git-checkout.md

@@ -0,0 +1,11 @@
+#git checkout
+
+> Checkout a branch or paths to the working tree
+
+- Switch to another branch
+
+`git checkout {{BRANCH-NAME}}`
+
+- Create and switch to a new branch
+
+`git checkout -b {{BRANCH-NAME}}`

+ 15 - 0
pages/common/git-clone.md

@@ -0,0 +1,15 @@
+#git clone
+
+> Clone an existing repository
+
+- Clone an existing repository
+
+`git clone {{REMOTE-REPOSITORY-LOCATION}}`
+
+- For cloning from the local machine
+
+`git clone -l`
+
+- Do it quietly
+
+`git clone -q`

+ 11 - 0
pages/common/git-commit.md

@@ -0,0 +1,11 @@
+#git commit
+
+>Commit staged files to the repository
+
+- Commit staged files to the repository with comment
+
+`git commit -m {{MESSAGE}}`
+
+- Replace the last commit with currently staged changes
+
+`git commit --amend`

+ 7 - 0
pages/common/git-diff.md

@@ -0,0 +1,7 @@
+#git diff
+
+> Show changes to tracked files
+
+- Show changes to tracked files
+
+`git diff {{PATHSPEC}}`

+ 11 - 0
pages/common/git-init.md

@@ -0,0 +1,11 @@
+#git init
+
+> Initializes a new local Git repository
+
+- Initialize a new local repository
+
+`git init`
+
+- Initialize a barebones repository
+
+`git init --bare`

+ 7 - 0
pages/common/git-log.md

@@ -0,0 +1,7 @@
+#git log
+
+>Show a history of commits
+
+- Show a history of commits
+
+`git log`

+ 11 - 0
pages/common/git-merge.md

@@ -0,0 +1,11 @@
+#git merge
+
+> Merge branches
+
+- Merge a branch with your current branch
+
+`git merge {{BRANCH-NAME}}`
+
+- Edit the merge message
+
+`git merge -e {{BRANCH-NAME}}`

+ 11 - 0
pages/common/git-push.md

@@ -0,0 +1,11 @@
+#git push
+
+> Push commits to a remote repository
+
+- Publish local changes on a remote location
+
+`git push {{REMOTE-NAME}} {{LOCAL-BRANCH}}`
+
+- Remove remote branches which don't exist locally
+
+`git push --prune {{REMOTE-NAME}}`

+ 11 - 0
pages/common/git-status.md

@@ -0,0 +1,11 @@
+#git status
+
+> Show the index (changed files)
+
+- Show changed files which are not yet added for commit
+
+`git status`
+
+- Give output in short format
+
+`git status -s`

+ 8 - 56
pages/common/git.md

@@ -2,66 +2,18 @@
 
 > Main command for all `git` commands
 
-- Create a new local repository
+- Check the Git version
 
-`git init`
+`git --version`
 
-- Show changed files which are not yet added for commit
+- Call general help
 
-`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`
-
-- 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}}`
+`git --help`
 
-- Merge a branch with your current HEAD branch
+- Call help on a command
 
-`git merge {{branch-name}}`
+`git help {{COMMAND}}`
 
-- Calling help
+- Execute Git command
 
-`git --help`
+`git {{COMMAND}}`