diff --git a/pages/common/git-add.md b/pages/common/git-add.md new file mode 100644 index 0000000000..e505ca9d4b --- /dev/null +++ b/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` + diff --git a/pages/common/git-branch.md b/pages/common/git-branch.md new file mode 100644 index 0000000000..47496d72ac --- /dev/null +++ b/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` \ No newline at end of file diff --git a/pages/common/git-checkout.md b/pages/common/git-checkout.md new file mode 100644 index 0000000000..0e61e44345 --- /dev/null +++ b/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}}` \ No newline at end of file diff --git a/pages/common/git-clone.md b/pages/common/git-clone.md new file mode 100644 index 0000000000..28c9d528da --- /dev/null +++ b/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` \ No newline at end of file diff --git a/pages/common/git-commit.md b/pages/common/git-commit.md new file mode 100644 index 0000000000..030264671e --- /dev/null +++ b/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` \ No newline at end of file diff --git a/pages/common/git-diff.md b/pages/common/git-diff.md new file mode 100644 index 0000000000..2a8ad3ce52 --- /dev/null +++ b/pages/common/git-diff.md @@ -0,0 +1,7 @@ +#git diff + +> Show changes to tracked files + +- Show changes to tracked files + +`git diff {{PATHSPEC}}` \ No newline at end of file diff --git a/pages/common/git-init.md b/pages/common/git-init.md new file mode 100644 index 0000000000..8dce8a41e0 --- /dev/null +++ b/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` \ No newline at end of file diff --git a/pages/common/git-log.md b/pages/common/git-log.md new file mode 100644 index 0000000000..5e4dd47045 --- /dev/null +++ b/pages/common/git-log.md @@ -0,0 +1,7 @@ +#git log + +>Show a history of commits + +- Show a history of commits + +`git log` \ No newline at end of file diff --git a/pages/common/git-merge.md b/pages/common/git-merge.md new file mode 100644 index 0000000000..4f69dfbc9d --- /dev/null +++ b/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}}` \ No newline at end of file diff --git a/pages/common/git-push.md b/pages/common/git-push.md new file mode 100644 index 0000000000..cf6701e5a3 --- /dev/null +++ b/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}}` \ No newline at end of file diff --git a/pages/common/git-status.md b/pages/common/git-status.md new file mode 100644 index 0000000000..f52cea84e3 --- /dev/null +++ b/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` \ No newline at end of file diff --git a/pages/common/git.md b/pages/common/git.md index cd98bf5c17..b2033a4b9e 100644 --- a/pages/common/git.md +++ b/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 - -`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}}` - -- Merge a branch with your current HEAD branch - -`git merge {{branch-name}}` - -- Calling help +- Call general help `git --help` + +- Call help on a command + +`git help {{COMMAND}}` + +- Execute Git command + +`git {{COMMAND}}` \ No newline at end of file