diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..4a3c0de --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +charset = utf-8 +insert_final_newline = true diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b595d90 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.exclude": { + "book/**": true + } +} diff --git a/src/branching.md b/src/branching.md index 9664d8d..d0cd686 100644 --- a/src/branching.md +++ b/src/branching.md @@ -1,5 +1,5 @@ # Branching -``` +```bash # Create a new branch. git branch diff --git a/src/collaboration.md b/src/collaboration.md index cba917a..776d0a0 100644 --- a/src/collaboration.md +++ b/src/collaboration.md @@ -1,5 +1,5 @@ # Collaboration -``` +```bash # Pull from default remote. git pull diff --git a/src/commits.md b/src/commits.md index 48d96ba..f522dcc 100644 --- a/src/commits.md +++ b/src/commits.md @@ -1,5 +1,5 @@ # Commits -``` +```bash # Use a basic GUI. Actually works quite well for staging hunks that can't be split. git gui diff --git a/src/commits/fixing.md b/src/commits/fixing.md index 961cd2d..aec596b 100644 --- a/src/commits/fixing.md +++ b/src/commits/fixing.md @@ -1,5 +1,5 @@ # Fixing commits -``` +```bash # Revert the last commit. git revert HEAD @@ -12,4 +12,4 @@ git revert --no-commit HEAD~3.. # Reset working files to match master (or another branch), removing local changes and commits. git fetch --all git reset --hard origin/ -``` \ No newline at end of file +``` diff --git a/src/configuration/git.md b/src/configuration/git.md index e394120..0aa8277 100644 --- a/src/configuration/git.md +++ b/src/configuration/git.md @@ -1,8 +1,8 @@ # Git configuration -``` +```bash # See where configuration options are set. git config --list --show-origin # Edit system/global/local. git config --system --edit -``` \ No newline at end of file +``` diff --git a/src/configuration/repository.md b/src/configuration/repository.md index 4fdfde5..52e7625 100644 --- a/src/configuration/repository.md +++ b/src/configuration/repository.md @@ -1,5 +1,5 @@ # Repository information -``` +```bash # List config details, including remotes, for the current repo. git config --local -l @@ -32,4 +32,4 @@ git count-objects -v # Runs database clean-up. git gc -``` \ No newline at end of file +``` diff --git a/src/configuration/user.md b/src/configuration/user.md index 63f4b71..5d52f45 100644 --- a/src/configuration/user.md +++ b/src/configuration/user.md @@ -1,5 +1,5 @@ # User information -``` +```bash # Pull user information. git config user.name git config user.email @@ -10,4 +10,4 @@ git config --global user.name "Your Name" # Update individual repository user name / email. git config user.name "Your Name" git config user.email "your_email@example.com" -``` \ No newline at end of file +``` diff --git a/src/example/create-new-repo-from-subdirectory.md b/src/example/create-new-repo-from-subdirectory.md index fe439bb..86af498 100644 --- a/src/example/create-new-repo-from-subdirectory.md +++ b/src/example/create-new-repo-from-subdirectory.md @@ -1,7 +1,7 @@ # Example: Create a new repo from a subdirectory Useful if you want to pull a directory, and its commit history, out into a new repo. -``` +```bash # Clone the repository into a new directory. git clone _.git diff --git a/src/example/update-fork.md b/src/example/update-fork.md index 6abda9f..f74dab7 100644 --- a/src/example/update-fork.md +++ b/src/example/update-fork.md @@ -1,6 +1,6 @@ # Example: Updating a fork -``` +```bash # On the fork: git checkout master diff --git a/src/logging.md b/src/logging.md index a216a81..9ea405f 100644 --- a/src/logging.md +++ b/src/logging.md @@ -1,5 +1,5 @@ # Logging -``` +```bash # View the last few commits. git log git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' diff --git a/src/stashing.md b/src/stashing.md index 6a27edc..60b0b5c 100644 --- a/src/stashing.md +++ b/src/stashing.md @@ -1,5 +1,5 @@ # Stashing changes -``` +```bash # If you can't pull/merge due to a file conflict, stashes changes, does a pull, and then puts the changes back, dropping the stash. # git stash pop = git stash apply && git stash drop git stash @@ -22,4 +22,4 @@ git stash show 'stash@{0}' # Show individual changes in a particular stash. git stash show -p 'stash@{0}' -``` \ No newline at end of file +``` diff --git a/src/tags.md b/src/tags.md index 608ce37..76be88d 100644 --- a/src/tags.md +++ b/src/tags.md @@ -1,5 +1,5 @@ # Tags -``` +```bash # List all tags. git tag @@ -11,4 +11,4 @@ git tag -d TagName # Push a tag to a remote (local by default). git push origin TagName -``` \ No newline at end of file +```