├── .gitignore ├── src ├── robots.txt ├── content │ ├── commands │ │ ├── git_bisect.adoc │ │ ├── git_diff.adoc │ │ ├── git_rebase.adoc │ │ ├── git_reset.adoc │ │ ├── git_revert.adoc │ │ ├── git_switch.adoc │ │ ├── git_restore.adoc │ │ ├── git_help.adoc │ │ ├── git_command.adoc │ │ ├── git_rm.adoc │ │ ├── git_show.adoc │ │ ├── git_stash.adoc │ │ ├── git_fetch.adoc │ │ ├── git_init.adoc │ │ ├── git_push.adoc │ │ ├── git_pull.adoc │ │ ├── git_remote.adoc │ │ ├── git_log.adoc │ │ ├── git_checkout.adoc │ │ ├── git_branch.adoc │ │ ├── git_status.adoc │ │ ├── git_config.adoc │ │ ├── git_merge.adoc │ │ ├── git_clone.adoc │ │ ├── git_add.adoc │ │ └── git_commit.adoc │ ├── git_internals │ │ ├── git_objects.adoc │ │ ├── the_git_directory.adoc │ │ └── git_deep.adoc │ ├── general_2 │ │ ├── merge_conflicts.adoc │ │ ├── checking_out_remote_branch.adoc │ │ └── fork_syncing.adoc │ ├── general_1 │ │ ├── git_bash.adoc │ │ ├── git_general.adoc │ │ ├── vcs.adoc │ │ ├── vcs_types.adoc │ │ └── repos_&_types.adoc │ ├── correcting_common_mistakes │ │ ├── common_mistakes.adoc │ │ └── unstage_added_files.adoc │ ├── terms │ │ ├── modified_files.adoc │ │ ├── untracked_files.adoc │ │ ├── added_files.adoc │ │ ├── sha1.adoc │ │ ├── repository.adoc │ │ ├── staging.adoc │ │ ├── collaborators.adoc │ │ ├── working_tree.adoc │ │ ├── contributors.adoc │ │ ├── head.adoc │ │ ├── gitignore.adoc │ │ ├── aliases.adoc │ │ └── branches.adoc │ ├── contributor_friendly_repo │ │ ├── code_of_conduct.adoc │ │ ├── contributing.adoc │ │ ├── making_repo_contributor_friendly.adoc │ │ ├── issues.adoc │ │ ├── license.adoc │ │ └── readme.adoc │ ├── github │ │ ├── what_is_github.adoc │ │ └── github_repositories.adoc │ └── misc │ │ ├── resources.adoc │ │ └── open_source_programs.adoc ├── google66b7e1d4dbf56798.html ├── static │ ├── img │ │ ├── GSOC.png │ │ ├── GSOD.png │ │ ├── add-1.jpg │ │ ├── add-2.jpg │ │ ├── add-3.jpg │ │ ├── cat-1.jpg │ │ ├── cvcs.png │ │ ├── dir-1.jpg │ │ ├── dir-2.jpg │ │ ├── dvcs.png │ │ ├── gsoc.png │ │ ├── gsod.png │ │ ├── log-1.jpg │ │ ├── lvcs.jpg │ │ ├── mlh.png │ │ ├── mv-1.jpg │ │ ├── du-c-1.jpg │ │ ├── du-c-2.jpg │ │ ├── du-c-3.jpg │ │ ├── du-c-4.jpg │ │ ├── favicon.ico │ │ ├── fetch-1.png │ │ ├── head-1.jpg │ │ ├── ls-a-1.jpg │ │ ├── mkdir_1.jpg │ │ ├── sha1sum.png │ │ ├── tree-1.png │ │ ├── branch-1.png │ │ ├── branch-2.png │ │ ├── branch-3.png │ │ ├── branch-4.png │ │ ├── branches.png │ │ ├── cat-logs.png │ │ ├── git-init.jpg │ │ ├── git-push.jpeg │ │ ├── og-image.png │ │ ├── outreachy.png │ │ ├── cat-file-p-1.jpg │ │ ├── cat-file-p-2.jpg │ │ ├── cat-file-p-3.jpg │ │ ├── cat-file-p-4.jpg │ │ ├── cat-file-p-5.jpg │ │ ├── cat-file-p-6.jpg │ │ ├── cat-file-p-7.jpg │ │ ├── cat-file-p-8.jpg │ │ ├── cat-file-t-1.jpg │ │ ├── fork-syncing.png │ │ ├── git-ls-files.png │ │ ├── icon-192x192.png │ │ ├── icon-512x512.png │ │ ├── cat-packed-refs.png │ │ ├── decompress-file.png │ │ ├── index-explained.png │ │ ├── types-of-merges.jpg │ │ ├── verify-pack-1.jpg │ │ ├── cat-FETCH_HEAD-1.png │ │ ├── cat-FETCH_HEAD-2.png │ │ ├── gh-branch-list-1.png │ │ ├── git-local-remote.png │ │ ├── admonition_icons │ │ │ ├── tip.png │ │ │ ├── note.png │ │ │ ├── caution.png │ │ │ ├── warning.png │ │ │ └── important.png │ │ ├── connection-graph-1.png │ │ ├── connection-graph-2.png │ │ ├── connection-graph-3.png │ │ ├── connection-graph-4.png │ │ ├── connection-graph-5.png │ │ ├── edit-master_file_1-1.jpg │ │ ├── fast-forward-merge.png │ │ ├── git-local-remote-2.png │ │ ├── the-linux-foundation.png │ │ ├── touch-master_file_1.jpg │ │ ├── touch-master_file_2.jpg │ │ ├── working-of-commit.jpeg │ │ ├── add-to-master_file_1-1.jpg │ │ ├── commit-master_file_1-1.jpg │ │ ├── moon.svg │ │ ├── up-arrow.svg │ │ ├── clear_cross.svg │ │ ├── git_basics_logo.svg │ │ └── sun.svg │ ├── html │ │ └── privacy_policy.html │ ├── highlight │ │ └── styles │ │ │ └── github-light-dark.min.css │ ├── js │ │ └── main.js │ └── css │ │ └── style.css ├── refs │ ├── misc.adoc │ ├── github_1.adoc │ ├── correcting_common_mistakes.adoc │ ├── general_2.adoc │ ├── git_internals.adoc │ ├── general_1.adoc │ ├── contributor_friendly_repo.adoc │ ├── terms.adoc │ └── commands.adoc ├── docinfo-footer.html ├── manifest.webmanifest ├── docinfo.html ├── index.adoc └── service-worker.js ├── .prettierignore ├── .prettierrc ├── .gitpod.yml ├── README.md ├── .github └── workflows │ └── build-deploy-website.yaml ├── CODE_OF_CONDUCT.md ├── temp.md ├── CONTRIBUTING.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | build 3 | -------------------------------------------------------------------------------- /src/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Allow: / 3 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | build/ 2 | src/static/highlight/ 3 | -------------------------------------------------------------------------------- /src/content/commands/git_bisect.adoc: -------------------------------------------------------------------------------- 1 | === git bisect 2 | 3 | ''' 4 | -------------------------------------------------------------------------------- /src/content/commands/git_diff.adoc: -------------------------------------------------------------------------------- 1 | === git diff 2 | 3 | ''' 4 | -------------------------------------------------------------------------------- /src/content/commands/git_rebase.adoc: -------------------------------------------------------------------------------- 1 | === git rebase 2 | 3 | ''' 4 | -------------------------------------------------------------------------------- /src/content/commands/git_reset.adoc: -------------------------------------------------------------------------------- 1 | === git reset 2 | 3 | ''' 4 | -------------------------------------------------------------------------------- /src/content/commands/git_revert.adoc: -------------------------------------------------------------------------------- 1 | === git revert 2 | 3 | ''' 4 | -------------------------------------------------------------------------------- /src/google66b7e1d4dbf56798.html: -------------------------------------------------------------------------------- 1 | google-site-verification: google66b7e1d4dbf56798.html 2 | -------------------------------------------------------------------------------- /src/static/img/GSOC.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/GSOC.png -------------------------------------------------------------------------------- /src/static/img/GSOD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/GSOD.png -------------------------------------------------------------------------------- /src/static/img/add-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/add-1.jpg -------------------------------------------------------------------------------- /src/static/img/add-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/add-2.jpg -------------------------------------------------------------------------------- /src/static/img/add-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/add-3.jpg -------------------------------------------------------------------------------- /src/static/img/cat-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/cat-1.jpg -------------------------------------------------------------------------------- /src/static/img/cvcs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/cvcs.png -------------------------------------------------------------------------------- /src/static/img/dir-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/dir-1.jpg -------------------------------------------------------------------------------- /src/static/img/dir-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/dir-2.jpg -------------------------------------------------------------------------------- /src/static/img/dvcs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/dvcs.png -------------------------------------------------------------------------------- /src/static/img/gsoc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/gsoc.png -------------------------------------------------------------------------------- /src/static/img/gsod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/gsod.png -------------------------------------------------------------------------------- /src/static/img/log-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/log-1.jpg -------------------------------------------------------------------------------- /src/static/img/lvcs.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/lvcs.jpg -------------------------------------------------------------------------------- /src/static/img/mlh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/mlh.png -------------------------------------------------------------------------------- /src/static/img/mv-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/mv-1.jpg -------------------------------------------------------------------------------- /src/static/img/du-c-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/du-c-1.jpg -------------------------------------------------------------------------------- /src/static/img/du-c-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/du-c-2.jpg -------------------------------------------------------------------------------- /src/static/img/du-c-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/du-c-3.jpg -------------------------------------------------------------------------------- /src/static/img/du-c-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/du-c-4.jpg -------------------------------------------------------------------------------- /src/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/favicon.ico -------------------------------------------------------------------------------- /src/static/img/fetch-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/fetch-1.png -------------------------------------------------------------------------------- /src/static/img/head-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/head-1.jpg -------------------------------------------------------------------------------- /src/static/img/ls-a-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/ls-a-1.jpg -------------------------------------------------------------------------------- /src/static/img/mkdir_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/mkdir_1.jpg -------------------------------------------------------------------------------- /src/static/img/sha1sum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/sha1sum.png -------------------------------------------------------------------------------- /src/static/img/tree-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/tree-1.png -------------------------------------------------------------------------------- /src/static/img/branch-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/branch-1.png -------------------------------------------------------------------------------- /src/static/img/branch-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/branch-2.png -------------------------------------------------------------------------------- /src/static/img/branch-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/branch-3.png -------------------------------------------------------------------------------- /src/static/img/branch-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/branch-4.png -------------------------------------------------------------------------------- /src/static/img/branches.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/branches.png -------------------------------------------------------------------------------- /src/static/img/cat-logs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/cat-logs.png -------------------------------------------------------------------------------- /src/static/img/git-init.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/git-init.jpg -------------------------------------------------------------------------------- /src/static/img/git-push.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/git-push.jpeg -------------------------------------------------------------------------------- /src/static/img/og-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/og-image.png -------------------------------------------------------------------------------- /src/static/img/outreachy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/outreachy.png -------------------------------------------------------------------------------- /src/refs/misc.adoc: -------------------------------------------------------------------------------- 1 | include::../content/misc/open_source_programs.adoc[] 2 | include::../content/misc/resources.adoc[] 3 | -------------------------------------------------------------------------------- /src/static/img/cat-file-p-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/cat-file-p-1.jpg -------------------------------------------------------------------------------- /src/static/img/cat-file-p-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/cat-file-p-2.jpg -------------------------------------------------------------------------------- /src/static/img/cat-file-p-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/cat-file-p-3.jpg -------------------------------------------------------------------------------- /src/static/img/cat-file-p-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/cat-file-p-4.jpg -------------------------------------------------------------------------------- /src/static/img/cat-file-p-5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/cat-file-p-5.jpg -------------------------------------------------------------------------------- /src/static/img/cat-file-p-6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/cat-file-p-6.jpg -------------------------------------------------------------------------------- /src/static/img/cat-file-p-7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/cat-file-p-7.jpg -------------------------------------------------------------------------------- /src/static/img/cat-file-p-8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/cat-file-p-8.jpg -------------------------------------------------------------------------------- /src/static/img/cat-file-t-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/cat-file-t-1.jpg -------------------------------------------------------------------------------- /src/static/img/fork-syncing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/fork-syncing.png -------------------------------------------------------------------------------- /src/static/img/git-ls-files.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/git-ls-files.png -------------------------------------------------------------------------------- /src/static/img/icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/icon-192x192.png -------------------------------------------------------------------------------- /src/static/img/icon-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/icon-512x512.png -------------------------------------------------------------------------------- /src/static/img/cat-packed-refs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/cat-packed-refs.png -------------------------------------------------------------------------------- /src/static/img/decompress-file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/decompress-file.png -------------------------------------------------------------------------------- /src/static/img/index-explained.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/index-explained.png -------------------------------------------------------------------------------- /src/static/img/types-of-merges.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/types-of-merges.jpg -------------------------------------------------------------------------------- /src/static/img/verify-pack-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/verify-pack-1.jpg -------------------------------------------------------------------------------- /src/refs/github_1.adoc: -------------------------------------------------------------------------------- 1 | include::../content/github/what_is_github.adoc[] 2 | include::../content/github/github_repositories.adoc[] 3 | -------------------------------------------------------------------------------- /src/static/img/cat-FETCH_HEAD-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/cat-FETCH_HEAD-1.png -------------------------------------------------------------------------------- /src/static/img/cat-FETCH_HEAD-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/cat-FETCH_HEAD-2.png -------------------------------------------------------------------------------- /src/static/img/gh-branch-list-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/gh-branch-list-1.png -------------------------------------------------------------------------------- /src/static/img/git-local-remote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/git-local-remote.png -------------------------------------------------------------------------------- /src/static/img/admonition_icons/tip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/admonition_icons/tip.png -------------------------------------------------------------------------------- /src/static/img/connection-graph-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/connection-graph-1.png -------------------------------------------------------------------------------- /src/static/img/connection-graph-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/connection-graph-2.png -------------------------------------------------------------------------------- /src/static/img/connection-graph-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/connection-graph-3.png -------------------------------------------------------------------------------- /src/static/img/connection-graph-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/connection-graph-4.png -------------------------------------------------------------------------------- /src/static/img/connection-graph-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/connection-graph-5.png -------------------------------------------------------------------------------- /src/static/img/edit-master_file_1-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/edit-master_file_1-1.jpg -------------------------------------------------------------------------------- /src/static/img/fast-forward-merge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/fast-forward-merge.png -------------------------------------------------------------------------------- /src/static/img/git-local-remote-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/git-local-remote-2.png -------------------------------------------------------------------------------- /src/static/img/the-linux-foundation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/the-linux-foundation.png -------------------------------------------------------------------------------- /src/static/img/touch-master_file_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/touch-master_file_1.jpg -------------------------------------------------------------------------------- /src/static/img/touch-master_file_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/touch-master_file_2.jpg -------------------------------------------------------------------------------- /src/static/img/working-of-commit.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/working-of-commit.jpeg -------------------------------------------------------------------------------- /src/static/img/add-to-master_file_1-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/add-to-master_file_1-1.jpg -------------------------------------------------------------------------------- /src/static/img/admonition_icons/note.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/admonition_icons/note.png -------------------------------------------------------------------------------- /src/static/img/commit-master_file_1-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/commit-master_file_1-1.jpg -------------------------------------------------------------------------------- /src/static/img/admonition_icons/caution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/admonition_icons/caution.png -------------------------------------------------------------------------------- /src/static/img/admonition_icons/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/admonition_icons/warning.png -------------------------------------------------------------------------------- /src/content/git_internals/git_objects.adoc: -------------------------------------------------------------------------------- 1 | === Git Objects 2 | 3 | Moved to link:https://git.harshkapadia.me[git.harshkapadia.me^]. 4 | 5 | ''' 6 | -------------------------------------------------------------------------------- /src/static/img/admonition_icons/important.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HarshKapadia2/git_basics/HEAD/src/static/img/admonition_icons/important.png -------------------------------------------------------------------------------- /src/content/git_internals/the_git_directory.adoc: -------------------------------------------------------------------------------- 1 | === The `.git` Directory 2 | 3 | Moved to link:https://git.harshkapadia.me[git.harshkapadia.me^]. 4 | 5 | ''' 6 | -------------------------------------------------------------------------------- /src/content/git_internals/git_deep.adoc: -------------------------------------------------------------------------------- 1 | === Git Deep 2 | 3 | Further resources for Git Internals. 4 | 5 | Moved to link:https://git.harshkapadia.me[git.harshkapadia.me^]. 6 | 7 | ''' 8 | -------------------------------------------------------------------------------- /src/refs/correcting_common_mistakes.adoc: -------------------------------------------------------------------------------- 1 | include::../content/correcting_common_mistakes/common_mistakes.adoc[] 2 | include::../content/correcting_common_mistakes/unstage_added_files.adoc[] 3 | -------------------------------------------------------------------------------- /src/content/general_2/merge_conflicts.adoc: -------------------------------------------------------------------------------- 1 | === Merge Conflicts 2 | 3 | ==== CLI 4 | 5 | ==== GUI 6 | 7 | .Related 8 | **** 9 | * link:#_git_merge[git merge] 10 | **** 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /src/refs/general_2.adoc: -------------------------------------------------------------------------------- 1 | include::../content/general_2/merge_conflicts.adoc[] 2 | include::../content/general_2/fork_syncing.adoc[] 3 | include::../content/general_2/checking_out_remote_branch.adoc[] 4 | -------------------------------------------------------------------------------- /src/refs/git_internals.adoc: -------------------------------------------------------------------------------- 1 | include::../content/git_internals/the_git_directory.adoc[] 2 | include::../content/git_internals/git_objects.adoc[] 3 | include::../content/git_internals/git_deep.adoc[] 4 | -------------------------------------------------------------------------------- /src/refs/general_1.adoc: -------------------------------------------------------------------------------- 1 | include::../content/general_1/vcs.adoc[] 2 | include::../content/general_1/vcs_types.adoc[] 3 | include::../content/general_1/git_general.adoc[] 4 | include::../content/general_1/git_bash.adoc[] 5 | include::../content/general_1/repos_&_types.adoc[] 6 | -------------------------------------------------------------------------------- /src/docinfo-footer.html: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /src/content/general_1/git_bash.adoc: -------------------------------------------------------------------------------- 1 | === Git-Bash 2 | 3 | * It is a shell, ie, a CLI to use git. 4 | * Once Git is installed, it can be used with Command Prompt, Powershell, Terminal, Zsh, etc as well. It is not mandatory to use Git Bash. 5 | * The official website to download Git-Bash is https://git-scm.com/[role=external,window=_blank]. 6 | 7 | ''' 8 | -------------------------------------------------------------------------------- /src/content/correcting_common_mistakes/common_mistakes.adoc: -------------------------------------------------------------------------------- 1 | There are some unwanted things everyone ends up doing while using Git and then one looks up the mistake to find a way to undo it. 2 | 3 | The following points are solutions to some mistakes that everyone makes 4 | 5 | * link:#_unstage_files_stagedadded_by_mistake[Unstage Files Staged/Added by Mistake] 6 | 7 | ''' 8 | -------------------------------------------------------------------------------- /src/content/terms/modified_files.adoc: -------------------------------------------------------------------------------- 1 | === Modified Files 2 | 3 | * All files not in the .gitignore, that have been added to the link:#_repository[repository (repo)] and have been modified since. 4 | * The files are NOT in their latest version (ie, they have been modified since they were last added). 5 | 6 | .Related 7 | **** 8 | * link:#_git_add[git add] 9 | **** 10 | 11 | ''' 12 | -------------------------------------------------------------------------------- /src/static/img/moon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/static/img/up-arrow.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/content/terms/untracked_files.adoc: -------------------------------------------------------------------------------- 1 | === Untracked Files 2 | 3 | * Newly created files are untracked files. 4 | * They are files that have never been added to the local link:#_repository[repository]. 5 | * In short: Untracked files are those files which are not in the link:#_gitignore_file[.gitignore file] and that have never been added to the repo. 6 | 7 | .Related 8 | **** 9 | * link:#_git_add[git add] 10 | **** 11 | 12 | ''' 13 | -------------------------------------------------------------------------------- /src/static/img/clear_cross.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/refs/contributor_friendly_repo.adoc: -------------------------------------------------------------------------------- 1 | include::../content/contributor_friendly_repo/making_repo_contributor_friendly.adoc[] 2 | include::../content/contributor_friendly_repo/readme.adoc[] 3 | include::../content/contributor_friendly_repo/contributing.adoc[] 4 | include::../content/contributor_friendly_repo/license.adoc[] 5 | include::../content/contributor_friendly_repo/code_of_conduct.adoc[] 6 | include::../content/contributor_friendly_repo/issues.adoc[] 7 | -------------------------------------------------------------------------------- /src/content/commands/git_switch.adoc: -------------------------------------------------------------------------------- 1 | === git switch 2 | 3 | ==== Command 4 | 5 | `git switch ` 6 | 7 | ==== Prerequisites 8 | 9 | The following term is required to be understood: 10 | 11 | * link:#_branches[Branches] 12 | 13 | ==== Description 14 | 15 | Switch to/view/check out a branch. 16 | 17 | Similar to link:#_git_checkout[`git checkout`]. 18 | 19 | .Related 20 | **** 21 | * link:#_git_checkout[git checkout] 22 | **** 23 | 24 | ''' 25 | -------------------------------------------------------------------------------- /src/content/general_1/git_general.adoc: -------------------------------------------------------------------------------- 1 | === Git 2 | 3 | * Git is a free and open source distributed version control system (DVCS) and has an emphasis on speed and performance. 4 | * It is supported by all operating systems. 5 | * Git is open source software distributed under the terms of the GNU (General Public License). 6 | * https://git-scm.com/[Official website^] 7 | 8 | [quote, git-scm, https://git-scm.com/] 9 | git --distributed-is-the-new-centralized 10 | 11 | ''' 12 | -------------------------------------------------------------------------------- /src/content/terms/added_files.adoc: -------------------------------------------------------------------------------- 1 | === Added Files 2 | 3 | * All files not in link:#_gitignore_file[`.gitignore`] and that have been added to the staging area of the link:#_repository[repository]. 4 | * The files are in their latest version (ie, they have not been modified since they were last added). 5 | * They are also called '*staged files*'. 6 | 7 | .Related 8 | **** 9 | * link:#_git_add[`git add`] 10 | * link:#_staging_staging_areaindex[Staging] 11 | **** 12 | 13 | ''' 14 | -------------------------------------------------------------------------------- /src/content/terms/sha1.adoc: -------------------------------------------------------------------------------- 1 | === SHA1 2 | 3 | * SHA = Secure Hashing Algorithm 4 | * It is a 40 digit hexadecimal number. 5 | * Every commit has a unique SHA1 associated with it. 6 | * All 40 characters are NOT needed for commands. The first 7 to 8 characters of the SHA1 will do. 7 | 8 | image::working-of-commit.jpeg[alt="Working of commit", 600, 600] 9 | 10 | .Related 11 | **** 12 | * link:#_git_commit[git commit] 13 | * link:#_git_log[git log] 14 | * link:#_git_show[git show] 15 | **** 16 | 17 | ''' 18 | -------------------------------------------------------------------------------- /src/content/commands/git_restore.adoc: -------------------------------------------------------------------------------- 1 | === git restore 2 | 3 | ==== Command 4 | 5 | `git restore ` 6 | 7 | ==== Description 8 | 9 | To replace a modified file in the working directory/copy with the added/committed state version of that file. 10 | 11 | If there are no staged changes, then the copy of the file in the local link:#_repository[repository] is used, otherwise the current file is overwritten by the staged copy of the file. 12 | 13 | Similar to link:#_git_checkout[`git checkout`]. 14 | 15 | .Related 16 | **** 17 | * link:#_git_checkout[git checkout] 18 | **** 19 | 20 | ''' 21 | -------------------------------------------------------------------------------- /src/static/html/privacy_policy.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | git_basics Privacy Policy 9 | 10 | 17 | 18 | 19 | 20 |

git_basics Privacy Policy

21 | 22 |
git_basics does not collect any data.
23 | 24 | 25 | -------------------------------------------------------------------------------- /src/refs/terms.adoc: -------------------------------------------------------------------------------- 1 | include::../content/terms/repository.adoc[] 2 | include::../content/terms/untracked_files.adoc[] 3 | include::../content/terms/added_files.adoc[] 4 | include::../content/terms/modified_files.adoc[] 5 | include::../content/terms/gitignore.adoc[] 6 | include::../content/terms/staging.adoc[] 7 | include::../content/terms/working_tree.adoc[] 8 | include::../content/terms/sha1.adoc[] 9 | include::../content/terms/aliases.adoc[] 10 | include::../content/terms/head.adoc[] 11 | include::../content/terms/branches.adoc[] 12 | include::../content/terms/collaborators.adoc[] 13 | include::../content/terms/contributors.adoc[] 14 | -------------------------------------------------------------------------------- /src/manifest.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "name": "git_basics", 3 | "short_name": "git_basics", 4 | "display": "standalone", 5 | "orientation": "portrait", 6 | "scope": "/git_basics/", 7 | "start_url": "/git_basics/", 8 | "id": "/git_basics/", 9 | "theme_color": "#000000", 10 | "background_color": "#000000", 11 | "icons": [ 12 | { 13 | "src": "./static/img/icon-192x192.png", 14 | "sizes": "192x192", 15 | "type": "image/png", 16 | "purpose": "any maskable" 17 | }, 18 | { 19 | "src": "./static/img/icon-512x512.png", 20 | "sizes": "512x512", 21 | "type": "image/png", 22 | "purpose": "any maskable" 23 | } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /src/content/terms/repository.adoc: -------------------------------------------------------------------------------- 1 | === Repository 2 | 3 | * Git stores information in a data structure called a repository (repo). 4 | * Simply put, a repo is a place where the history of the user's work is stored. 5 | 6 | * Types of repos 7 | ** Local repo 8 | ** Remote repo 9 | *** Public repo 10 | *** Private repo 11 | 12 | + 13 | For more information on the types of repos, refer to the link:#_repositories_its_types[Repos & types] section. 14 | 15 | .Related 16 | **** 17 | * link:#_repositories_its_types[Repos & types] 18 | * link:#_what_is_github[GitHub] 19 | * link:#_github_repositories[GitHub repositories] 20 | **** 21 | 22 | ''' 23 | -------------------------------------------------------------------------------- /src/content/commands/git_help.adoc: -------------------------------------------------------------------------------- 1 | === git help 2 | 3 | ==== Command 4 | 5 | `git help ` 6 | 7 | ==== Description 8 | 9 | Give information about Git or a certain Git command (from the man pages in the Git package itself). 10 | 11 | ==== Options/Flags 12 | 13 | ===== No option 14 | 15 | * Synopsis of the git command and a list of the most commonly used Git commands are printed on the standard output. 16 | 17 | ===== or 18 | 19 | * Any Git command name (eg: commit, add, etc...) can be entered. 20 | * A man (manual) page which is included in the Git package will be opened in the browser. 21 | * Eg: `git help add` 22 | 23 | ''' 24 | -------------------------------------------------------------------------------- /src/content/contributor_friendly_repo/code_of_conduct.adoc: -------------------------------------------------------------------------------- 1 | === Code of Conduct 2 | 3 | * A Code of Conduct (CoC) facilitates healthy and constructive community behavior by establishing expectations for behavior for a project’s participants. 4 | * The link:https://www.contributor-covenant.org/[Contributor Covenant^] is a common CoC used by open source projects. 5 | * A commonly used CoC can be added directly from the 'Community' tab in the 'Insights' section of a repository. If the CoC is not present in the CoC section, a file called `CODE_OF_CONDUCT.md` can be created and the content of the CoC can be pasted in it. 6 | * link:https://opensource.guide/code-of-conduct/[More information on CoC^]. 7 | 8 | ''' 9 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "always", 3 | "bracketSpacing": true, 4 | "cursorOffset": -1, 5 | "embeddedLanguageFormatting": "auto", 6 | "endOfLine": "auto", 7 | "filepath": "", 8 | "htmlWhitespaceSensitivity": "css", 9 | "insertPragma": false, 10 | "jsxBracketSameLine": false, 11 | "jsxSingleQuote": false, 12 | "overrides": [], 13 | "plugins": [], 14 | "pluginSearchDirs": [], 15 | "printWidth": 80, 16 | "proseWrap": "preserve", 17 | "quoteProps": "as-needed", 18 | "rangeEnd": null, 19 | "rangeStart": 0, 20 | "requirePragma": false, 21 | "semi": true, 22 | "singleQuote": false, 23 | "tabWidth": 4, 24 | "trailingComma": "none", 25 | "useTabs": true, 26 | "vueIndentScriptAndStyle": false 27 | } 28 | -------------------------------------------------------------------------------- /src/content/commands/git_command.adoc: -------------------------------------------------------------------------------- 1 | === git 2 | 3 | ==== Command 4 | 5 | `git ` 6 | 7 | ==== Description 8 | 9 | Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals. 10 | 11 | [quote, git-scm, https://git-scm.com/docs/git] 12 | git - the stupid content tracker 13 | 14 | ==== Options/Flags 15 | 16 | ===== --version 17 | 18 | * Prints the Git suite version that the git program came from. 19 | 20 | ===== --help 21 | 22 | * Prints the synopsis and a list of the most commonly used commands. 23 | * If the flag `--all` or `-a`is given then all available commands are printed. 24 | 25 | ''' 26 | -------------------------------------------------------------------------------- /src/content/contributor_friendly_repo/contributing.adoc: -------------------------------------------------------------------------------- 1 | === CONTRIBUTING.md 2 | 3 | * The `CONTRIBUTING.md` file explains how a contributor should do things like format code, test fixes, and submit patches. It can also include instructions for contributors to set up a local environment. 4 | * `md` stands for 'Markdown', which is a lightweight and very easy to learn markup language to create rich text using a plain text editor. 5 | ** link:https://www.youtube.com/watch?v=HUBNt18RFbo[A video to learn the syntax^] 6 | ** link:https://github.com/tchapi/markdown-cheatsheet[Markdown cheat sheet^] 7 | 8 | * A link:https://github.com/HarshKapadia2/attendance_management/blob/master/CONTRIBUTING.md[sample template^] 9 | 10 | ''' 11 | -------------------------------------------------------------------------------- /src/content/terms/staging.adoc: -------------------------------------------------------------------------------- 1 | === Staging (staging area/index) 2 | 3 | * It notes the link:#_added_files[added files] in the working directory/copy - a copy of the most recent state of the files you're working on. 4 | * To stage a file is simply to prepare it finely for a commit. 5 | * Refer to the link:#_git_add[diagram]. 6 | * Git, with its index allows you to commit only certain parts of the changes you've done since the last commit. 7 | * https://medium.com/mindorks/what-is-git-commit-push-pull-log-aliases-fetch-config-clone-56bc52a3601c[Further Details^]. 8 | 9 | .Related 10 | **** 11 | * link:#_added_files[Added files] 12 | * link:#_git_add[`git add`] 13 | * link:#_git_rm[`git rm`] 14 | * link:#_git_commit[`git commit`] 15 | **** 16 | 17 | ''' 18 | -------------------------------------------------------------------------------- /src/content/terms/collaborators.adoc: -------------------------------------------------------------------------------- 1 | === Collaborators 2 | 3 | * Collaborators are the link:#_repository[repository (repo)] owner's team members/partners. 4 | * A collaborator has a lot of accesses that a repo owner has. 5 | * They can directly push to the repository, merge PRs, etc. 6 | * The owner of the repo can invite any number of collaborator from the `settings/manage access` section in the repo (there is a limit to the number of invites in 24 hrs). 7 | 8 | NOTE: A link:#_contributors[contributor] is a collaborator only if he is chosen to be a collaborator by the owner. So a collaborator is a contributor, but the vice versa is not always true. 9 | 10 | .Related 11 | **** 12 | * link:#_github_repositories[GitHub Repository] 13 | **** 14 | 15 | ''' 16 | -------------------------------------------------------------------------------- /src/content/github/what_is_github.adoc: -------------------------------------------------------------------------------- 1 | === What is GitHub? 2 | 3 | * *GitHub != Git*, ie, GitHub is not Git. 4 | ** Git is a revision control system, a tool to manage your source code history. 5 | ** *GitHub is a hosting service for Git link:#_repository[repositories].* 6 | ** So they are not the same thing: Git is the tool, GitHub is the service for projects that use Git. 7 | 8 | * https://github.com/[GitHub^] is just one such service for Git. Other prominent services include GitLab, Bitbucket, Git Kraken, etc. 9 | 10 | * link:https://guides.github.com/[Official GitHub guides^]. 11 | 12 | * link:https://help.github.com/en[Official GitHub documentation^]. 13 | 14 | * link:https://opensource.guide/[A guide to open source by GitHub^]. 15 | 16 | ''' 17 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | tasks: 2 | - name: Setup 3 | before: | 4 | # Needs to be in `before` since Gitpod resets the container every time 5 | 6 | # Install Asciidoctor 7 | gem install asciidoctor 8 | 9 | # Globally install `serve` 10 | npm install --location=global serve 11 | 12 | exit 13 | 14 | vscode: 15 | extensions: 16 | - esbenp.prettier-vscode 17 | - asciidoctor.asciidoctor-vscode 18 | - redhat.vscode-yaml 19 | - streetsidesoftware.code-spell-checker 20 | - ritwickdey.liveserver 21 | 22 | ports: 23 | - port: 3000 24 | onOpen: open-browser 25 | visibility: public 26 | - port: 5500 27 | onOpen: open-browser 28 | visibility: public 29 | -------------------------------------------------------------------------------- /src/content/terms/working_tree.adoc: -------------------------------------------------------------------------------- 1 | === Working Tree 2 | 3 | * It notes the untracked files in the working directory/copy - a copy of the most recent state of the files one is working on. 4 | * Any changes to files will be marked and seen in the Working Tree. 5 | * Here if one makes changes and do not explicitly save them to git, they will lose the changes made to their files. 6 | * If one makes changes to files in their working tree, git will recognize that are modified, but until they tell git “Hey pay attention to these files,” it won’t save anything that goes on in them. 7 | * https://medium.com/mindorks/what-is-git-commit-push-pull-log-aliases-fetch-config-clone-56bc52a3601c[Further details^]. 8 | 9 | .Related 10 | **** 11 | * link:#_git_add[git add] 12 | **** 13 | 14 | ''' 15 | -------------------------------------------------------------------------------- /src/content/contributor_friendly_repo/making_repo_contributor_friendly.adoc: -------------------------------------------------------------------------------- 1 | Open source is all about opening up projects for the community to use and contribute to! Contributions are a very important aspect of open source. Contributions help the community in improving software/projects that they use, for themselves and others. 2 | 3 | To make contributions easier, the following files/tools are used in a repository 4 | 5 | * link:#_readme_md[`README.md`] 6 | * link:#_contributing_md[`CONTRIBUTING.md`] 7 | * link:#_license[`LICENSE`] 8 | * link:#_code_of_conduct[`CODE_OF_CONDUCT.md`] 9 | * link:#_issues[Issues] 10 | 11 | They are discussed below. 12 | 13 | TIP: A good place to get to know how a repository compares with the recommended community standards and add the missing files is the 'Community' tab in the 'Insights' section of a repository. 14 | 15 | ''' 16 | -------------------------------------------------------------------------------- /src/content/commands/git_rm.adoc: -------------------------------------------------------------------------------- 1 | === git rm 2 | 3 | ==== Command 4 | 5 | `git rm ` where `ext`stands for the extension of the file. 6 | 7 | ==== Prerequisite 8 | 9 | The following term is required to be understood: 10 | 11 | * link:#_staging_staging_areaindex[Staging (staging area/index)] 12 | 13 | ==== Description 14 | 15 | To remove files from the working tree and from the index. 16 | 17 | ==== Options/Flags 18 | 19 | ===== --cached 20 | 21 | * To unstage a particular file (ie, remove file from the staging area). 22 | * use `""` if the file name has spaces in between. 23 | 24 | ===== -r --cached . 25 | 26 | * Eg: `git rm -r --cached .` 27 | * Recursive command to remove all files from the staging area. 28 | 29 | .Related 30 | **** 31 | * link:#_git_add[Add files to staging area (`git add`)] 32 | **** 33 | 34 | ''' 35 | -------------------------------------------------------------------------------- /src/content/commands/git_show.adoc: -------------------------------------------------------------------------------- 1 | === git show 2 | 3 | ==== Command 4 | 5 | `git show ` 6 | 7 | ==== Prerequisite 8 | 9 | The following term is required to be understood: 10 | 11 | * link:#_sha1[SHA1] 12 | 13 | ==== Description 14 | 15 | To see information about a specific commit or file. Use link:#_git_log[`git log`] to get the SHA1 of the required commit. 16 | 17 | ==== Options/Flags 18 | 19 | ===== 20 | 21 | * To see more information about a specific commit than what `git log ` shows. 22 | 23 | ===== --name-only 24 | 25 | * To view just the name of the files changed in a particular commit. 26 | 27 | ===== : 28 | 29 | * To view the contents of committed or staged files. 30 | * Eg: `git show :test_file.txt` 31 | 32 | .Related 33 | **** 34 | * link:#_git_log[git log] 35 | **** 36 | 37 | ''' 38 | -------------------------------------------------------------------------------- /src/content/commands/git_stash.adoc: -------------------------------------------------------------------------------- 1 | === git stash 2 | 3 | ==== Command 4 | 5 | `git stash` 6 | 7 | ==== Description 8 | 9 | Saving changes temporarily. 10 | 11 | NOTE: All link:#_added_files[tracked] and link:#_untracked_filed[untracked] local changes are stashed, i.e., all changes in the link:#_working_tree[working tree] are stashed. 12 | 13 | https://www.git-tower.com/learn/git/ebook/en/command-line/branching-merging/stashing[Commands and explanation^] 14 | 15 | ==== Options/Flags 16 | 17 | ===== No option 18 | 19 | * Saves the current working tree to the stash. 20 | 21 | ===== list 22 | 23 | * Lists all the available stashes 24 | 25 | ===== show -p stash@{0} 26 | 27 | * Shows the changes in a particular stash entry. 28 | * Find the stash number using the `git stash list` command. 29 | 30 | ===== pop 31 | 32 | * Apply the changes of the latest stash entry. 33 | 34 | ''' 35 | -------------------------------------------------------------------------------- /src/content/terms/contributors.adoc: -------------------------------------------------------------------------------- 1 | === Contributors 2 | 3 | * Contributors are people who contribute to link:#_repository[repositories] to make them better. 4 | 5 | NOTE: A contributor is a link:#_collaborators[collaborator] only if he is chosen to be a collaborator by the owner. So a collaborator is a contributor, but the vice versa is not always true. 6 | 7 | ==== General contributor instructions 8 | 9 | * [Fork] the repo. 10 | * link:#_git_clone[clone] the forked repo locally. 11 | * Work on the contribution(s) according to the [issues] and/or [`CONTRIBUTING.md`]. 12 | 13 | TIP: Follow correct link:#_git_commit[commit message] structure. Eg: `:bug: fix: Login button position corrected (#26, #32, #33)` 14 | 15 | * link:#_git_push[Push] the code to the forked repo. 16 | * Make a [pull request (PR)]! 17 | 18 | .Related 19 | **** 20 | * link:#_github_repositories[GitHub Repository] 21 | **** 22 | 23 | ''' 24 | -------------------------------------------------------------------------------- /src/content/commands/git_fetch.adoc: -------------------------------------------------------------------------------- 1 | === git fetch 2 | 3 | ==== Command 4 | 5 | `git fetch ` 6 | 7 | ==== Prerequisites 8 | 9 | The following terms are required to be understood: 10 | 11 | * link:#_aliases[Aliases] 12 | * link:#_repository[Repository (repo)] 13 | * link:#_branches[Branches] 14 | 15 | ==== Description 16 | 17 | On running `git fetch`, Git gathers any commits from the target branch that do not exist in the current local branch and stores them in the local repository. However, it does not merge them with the current branch (unlike link:#_git_pull[`git pull`]). 18 | 19 | This is particularly useful if you need to keep your repository up to date, but are working on something that might break if you update your files. 20 | 21 | To integrate the commits into your master branch, you use link:#_git_merge[`git merge`]. 22 | 23 | .Related 24 | **** 25 | * link:#_git_pull[git pull] 26 | * link:#_git_merge[git merge] 27 | **** 28 | 29 | ''' 30 | -------------------------------------------------------------------------------- /src/content/commands/git_init.adoc: -------------------------------------------------------------------------------- 1 | === git init 2 | 3 | ==== Command 4 | 5 | `git init` 6 | 7 | ==== Prerequisites 8 | 9 | The following terms are required to be understood: 10 | 11 | * link:#_repository[Repository (repo)] 12 | 13 | ==== Description 14 | 15 | To initialize a local git repository in the location to which the bash is pointing. A hidden folder `.git` is created in the directory. None of the commands below will work if there is no local git repo initialized. 16 | 17 | CAUTION: If the remote repository is/is going to be located on GitHub, please be aware of the link:#_main_vs_master_2[`main` vs `master` default branch issue] which might cause link:#_git_push[`git push`] to fail. 18 | 19 | ==== Options/Flags 20 | 21 | ===== No option 22 | 23 | - Initializes new repo in the current directory. 24 | - Creates `./.git`. 25 | 26 | ===== 27 | 28 | - Eg: `git init ` 29 | - Initializes a new repo in `./`. 30 | - Creates `.//.git`. 31 | 32 | ''' 33 | -------------------------------------------------------------------------------- /src/content/commands/git_push.adoc: -------------------------------------------------------------------------------- 1 | === git push 2 | 3 | ==== Command 4 | 5 | `git push -u ` 6 | 7 | ==== Prerequisites 8 | 9 | The following terms are required to be understood: 10 | 11 | * link:#_aliases[Aliases] 12 | * link:#_repository[Repository (repo)] 13 | * link:#_branches[Branches] 14 | 15 | ==== Description 16 | 17 | This command is used to transfer files from the local repo to the remote repo. 18 | 19 | To set up a remote repo, refer to link:#_git_remote[`git remote`] and [`creating a repo on GitHub`]. 20 | 21 | WARNING: If the push is to a newly created empty repository on GitHub, the link:#_main_vs_master_2[`main` vs `master` default branch issue] might cause it to fail. 22 | 23 | image::git-push.jpeg[alt="Git push illustration", 600, 600] 24 | 25 | image::fast-forward-merge.png[alt="Fast forward merge", 600, 600] 26 | 27 | NOTE: From the two pictures above, it can be inferred that Git will allow pushing only if the push results in a fast-forward merge. 28 | 29 | ''' 30 | -------------------------------------------------------------------------------- /src/content/general_1/vcs.adoc: -------------------------------------------------------------------------------- 1 | === Version Controlling Systems (VCS) 2 | 3 | * In computer software engineering, revision control is any kind of practice that tracks and provides control over changes to source code. 4 | * As teams design, develop and deploy software, it is common for multiple versions of the same software to be deployed in different sites and for the software's developers to be working simultaneously on updates. 5 | * Bugs or features of the software are often only present in certain versions (because of the fixing of some problems and the introduction of others as the program develops). Therefore, for the purposes of locating and fixing bugs, it is vitally important to be able to retrieve and run different versions of the software to determine in which version(s) the problem occurs. 6 | * It may also be necessary to develop two versions of the software concurrently: for instance, where one version has bugs fixed, but no new features (branch), while the other version is where new features are worked on (trunk). 7 | 8 | ''' 9 | -------------------------------------------------------------------------------- /src/static/img/git_basics_logo.svg: -------------------------------------------------------------------------------- 1 | git_basics -------------------------------------------------------------------------------- /src/content/terms/head.adoc: -------------------------------------------------------------------------------- 1 | === HEAD 2 | 3 | * HEAD is a reference to the latest commit in the current link:#_branches[branch]. 4 | * When a commit is made, Git automatically sets the HEAD to the latest commit. 5 | 6 | NOTE: HEAD is contextual. It will point to the latest commit in the current branch. 7 | 8 | image::working-of-commit.jpeg[alt="Working of Commit", 600, 600] 9 | 10 | * To check where the current HEAD is pointing, run `cat .git/HEAD` in the root directory. 11 | ** Eg: 12 | 13 | # in the 'main' branch 14 | $ cat .git/HEAD 15 | ref: refs/heads/main 16 | $ git switch test_branch 17 | Switched to branch 'test_branch' 18 | $ cat .git/HEAD 19 | ref: refs/heads/test_branch 20 | 21 | [#_detached_head] 22 | * When the HEAD points to a commit that is not the latest commit in a branch, that is a *detached HEAD*. A specific commit can be referred to, using link:#_git_checkout[`git checkout`]. 23 | 24 | .Related 25 | **** 26 | * link:#_git_checkout[git checkout] 27 | * link:#_git_commit[git commit] 28 | * link:#_git_log[git log] 29 | * link:#_git_merge[git merge] 30 | **** 31 | 32 | ''' 33 | -------------------------------------------------------------------------------- /src/static/img/sun.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/content/commands/git_pull.adoc: -------------------------------------------------------------------------------- 1 | image::git-local-remote-2.png[alt="Git local & remote commands chart #2", 600, 600] 2 | 3 | ''' 4 | 5 | === git pull 6 | 7 | ==== Command 8 | 9 | `git pull ` 10 | 11 | Eg: `git pull origin master` 12 | 13 | ==== Prerequisites 14 | 15 | The following terms are required to be understood: 16 | 17 | * link:#_aliases[Aliases] 18 | * link:#_repository[Repository (repo)] 19 | * link:#_branches[Branches] 20 | 21 | ==== Description 22 | 23 | Pulls (brings) the latest code from the remote repo. 24 | 25 | To fetch and download content from a remote repository and immediately update the local repository to match the content. 26 | 27 | https://www.git-tower.com/learn/git/faq/difference-between-git-fetch-git-pull[Difference between `git pull` and `git fetch`^] 28 | 29 | * In simple terms, `git pull` does a `git fetch` followed by a `git merge`. 30 | * `git pull` automatically merges commits without letting you review them first. If you don’t closely manage your branches, you may run into frequent conflicts. 31 | 32 | .Related 33 | **** 34 | * link:#_git_fetch[git fetch] 35 | * link:#_git_merge[git merge] 36 | **** 37 | 38 | ''' 39 | -------------------------------------------------------------------------------- /src/content/correcting_common_mistakes/unstage_added_files.adoc: -------------------------------------------------------------------------------- 1 | === Unstage Files Staged/Added by Mistake 2 | 3 | A lot of times files are added/staged by mistake, no matter whether they are new or modified. The solution below will unstage all the files that were staged by mistake. 4 | 5 | ==== Prerequisites 6 | 7 | * link:#_added_files[Added/staged files] 8 | * link:#_staging_staging_areaindex[Staging] 9 | 10 | ==== Solution 11 | 12 | NOTE: The commands below will simply unstage added files and will NOT result in data loss. 13 | 14 | * General syntax: `git reset HEAD \-- ""` 15 | 16 | * Files 17 | 18 | ** For a single file, use `git reset HEAD \-- ""`. 19 | 20 | ** For multiple files, use `git reset HEAD \-- "" ""...`. 21 | 22 | ** For files with the same extension, use `git reset HEAD \-- "<*.ext>"`. 23 | 24 | * Directories/folders 25 | 26 | ** For a single directory, use `git reset HEAD \-- ""`. 27 | 28 | ** For multiple directories, use `git reset HEAD \-- "" ""...`. 29 | 30 | * To unstage everything in the staging area, use `git reset HEAD` or `git reset HEAD \-- *`. 31 | 32 | ''' 33 | -------------------------------------------------------------------------------- /src/content/general_1/vcs_types.adoc: -------------------------------------------------------------------------------- 1 | === Types of Version Control Systems (VCS) 2 | 3 | ==== Local VCS (LVCS) 4 | 5 | * Local version control system maintains track of files within the local system. This approach is very common and simple. This type is also error prone which means the chances of accidentally writing to the wrong file is higher. 6 | 7 | image::lvcs.jpg[alt="LVCS", 600, 600] 8 | 9 | ==== Centralized VCS (CVCS) 10 | 11 | * In this approach, all the changes in the files are tracked under the centralized server. The centralized server includes all the information of versioned files, and list of clients that check out files from that central place. 12 | * Eg: Tortoise SVN 13 | 14 | image::cvcs.png[alt="CVCS", 600, 600] 15 | 16 | ==== Distributed VCS (DVCS) 17 | 18 | * Distributed version control systems come into picture to overcome the drawback of centralized version control system. 19 | * Clients completely clone the repository including its full history. If any server dies, any of the client repositories can be copied on to the server which help restore the server. Every clone is considered as a full backup of all the data. 20 | * Eg: Git 21 | 22 | image::dvcs.png[alt="DVCS", 600, 600] 23 | 24 | ''' 25 | -------------------------------------------------------------------------------- /src/refs/commands.adoc: -------------------------------------------------------------------------------- 1 | include::../content/commands/git_command.adoc[] 2 | include::../content/commands/git_help.adoc[] 3 | include::../content/commands/git_config.adoc[] 4 | include::../content/commands/git_init.adoc[] 5 | include::../content/commands/git_add.adoc[] 6 | include::../content/commands/git_status.adoc[] 7 | include::../content/commands/git_commit.adoc[] 8 | include::../content/commands/git_log.adoc[] 9 | include::../content/commands/git_rm.adoc[] 10 | include::../content/commands/git_pull.adoc[] 11 | include::../content/commands/git_fetch.adoc[] 12 | include::../content/commands/git_clone.adoc[] 13 | include::../content/commands/git_merge.adoc[] 14 | include::../content/commands/git_branch.adoc[] 15 | include::../content/commands/git_checkout.adoc[] 16 | include::../content/commands/git_remote.adoc[] 17 | include::../content/commands/git_push.adoc[] 18 | include::../content/commands/git_show.adoc[] 19 | include::../content/commands/git_stash.adoc[] 20 | include::../content/commands/git_reset.adoc[] 21 | include::../content/commands/git_revert.adoc[] 22 | include::../content/commands/git_rebase.adoc[] 23 | include::../content/commands/git_bisect.adoc[] 24 | include::../content/commands/git_diff.adoc[] 25 | include::../content/commands/git_switch.adoc[] 26 | include::../content/commands/git_restore.adoc[] 27 | -------------------------------------------------------------------------------- /src/content/contributor_friendly_repo/issues.adoc: -------------------------------------------------------------------------------- 1 | === Issues 2 | 3 | * Most software projects have a bug tracker of some kind. link:#_what_is_github[GitHub’s] tracker is called 'Issues', and has its own section in every repository. 4 | * Issues are a great way to keep track of tasks, enhancements, and bugs for projects. They’re kind of like e-mail, except they can be shared and discussed with the rest of the team. 5 | * If the link:#_github_repositories[repository is public], then anyone can raise an issue. 6 | * Labels 7 | ** Issues have colour coded labels that help categorize and filter issues. 8 | ** Every issue can have multiple labels that can be modified at any time. 9 | ** Some labels are provided by GitHub and they can be custom created as well. 10 | ** Labels for new/beginner contributors: 11 | *** good-first-issue 12 | *** link:#_resources/:~:text=first%20timers%20only[first-timers-only] 13 | * Issues and pull requests (PRs) can be referred to using `#`. Every issue and pull request has a number associated with it (usually mentioned at the top of the issue/PR, beside the title.) So `#69` or `#420` are examples of how issues/PRs can be referred to, in commit messages, PRs or issues. 14 | * Refer to link:https://guides.github.com/features/issues/[GitHub’s guide^] for more on issues. 15 | 16 | ''' 17 | -------------------------------------------------------------------------------- /src/content/commands/git_remote.adoc: -------------------------------------------------------------------------------- 1 | === git remote 2 | 3 | ==== Command 4 | 5 | `git remote ` 6 | 7 | ==== Prerequisites 8 | 9 | The following term is required to be understood: 10 | 11 | * link:#_aliases[Aliases] 12 | * link:#_repository[Repository (repo)] 13 | 14 | ==== Description 15 | 16 | Helps to make, view or break connections to other remote or local repositories. 17 | 18 | To add a remote repo to a local repo: 19 | 20 | * Create a remote repo on GitHub, GitLab, BitBucket, etc. 21 | * On the CLI, type `git remote add origin .git` 22 | 23 | ==== Options/Flags 24 | 25 | ===== 26 | 27 | * Lists the repos to which connections exist. 28 | 29 | ===== -v or --verbose 30 | 31 | * It gives the link:#_aliases[alias] and corresponding URL of the connected repos. 32 | 33 | ===== add <.git> 34 | 35 | * To connect to a local or remote repo. 36 | 37 | [.word-break-all] 38 | * To connect to a remote repo: `git remote add origin https://github.com/HarshKapadia2/git_basics.git` 39 | * To connect to a local repo: `git remote add origin x:/coding/git/local_repo` 40 | 41 | ===== rm 42 | 43 | * Removes an existing repo connection. 44 | * Eg: `git remote rm origin` 45 | 46 | NOTE: This command only removes the connection between two repos. It does not delete any data. 47 | 48 | ''' 49 | -------------------------------------------------------------------------------- /src/content/terms/gitignore.adoc: -------------------------------------------------------------------------------- 1 | === .gitignore file 2 | 3 | * .gitignore is a file which tells git which files (or patterns) in the directory it should ignore. 4 | * It's usually used to avoid committing transient files from the working directory/copy (a copy of the most recent state of the files you're working on) that aren't useful to other collaborators, such as compilation products, temporary files that IDEs create, etc. 5 | 6 | ==== Syntax 7 | 8 | * Comments start with `#`. 9 | * Ignored file names to be written in the format `file_name.ext`. eg: `test.txt` 10 | * `*.ext` ignores all files with the extension `.ext`. 11 | * If a file is in a directory, use `dir_name/file_name.ext`. 12 | * If all the files in a directory need to be excluded, use `relative/path/to/dir`. 13 | * https://github.com/github/gitignore[A resource for .gitignore file templates for different programming languages^] 14 | 15 | ==== Ignore files locally without modifying `.gitignore` 16 | 17 | * You can ignore a file/folder only for your local repository without modifying `.gitignore` by adding a pattern in `.git/info/exclude`. 18 | * The syntax is the same as for `.gitignore`. 19 | * This is useful if you want to keep a local `TODO` list, but don't want to commit it to the repository, and don't want to modify `.gitignore` for everyone. 20 | 21 | .Related 22 | **** 23 | * link:#_git_add[git add] 24 | **** 25 | 26 | ''' 27 | -------------------------------------------------------------------------------- /src/content/commands/git_log.adoc: -------------------------------------------------------------------------------- 1 | === git log 2 | 3 | ==== Command 4 | 5 | `git log ` 6 | 7 | ==== Prerequisite 8 | 9 | The following terms are required to be understood: 10 | 11 | * link:#_sha1[SHA1] 12 | * link:#_head[HEAD] 13 | * link:#_branches[Branches] 14 | 15 | ==== Description 16 | 17 | It is a running record of commits. It shows all the commits reachable from the current HEAD (where the next commit will attach). 18 | 19 | Implicitly means `git log HEAD`. 20 | 21 | ==== Options/Flags 22 | 23 | ===== 24 | 25 | * It will display the details of that commit. 26 | * For more details of the commit, use link:#_git_show[`git show`]. 27 | 28 | ===== 29 | 30 | * It will display the commit log of that branch. 31 | 32 | ===== --oneline 33 | 34 | * Displays the first 7 characters of the SHA1 and the commit message. 35 | 36 | ===== --graph 37 | 38 | * It will display commits as a graph. 39 | * To make it look better, use the `--oneline` or/and `--decorate` flags. 40 | * Eg: `git log --graph --oneline --decorate` 41 | 42 | ===== --stat 43 | 44 | * Displays the files and no. of lines added or removed, in each commit. 45 | 46 | ===== '--patch' or '-p -' 47 | 48 | * Gives details of files changed, specific changes and location of changes in the file. 49 | 50 | .Related 51 | **** 52 | * link:#_git_show[git show] 53 | **** 54 | 55 | ''' 56 | -------------------------------------------------------------------------------- /src/content/terms/aliases.adoc: -------------------------------------------------------------------------------- 1 | === Aliases 2 | 3 | [quote, Pro Git by Scott Chacon and Ben Straub, https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases] 4 | [Aliases] make your Git experience simpler, easier, and more familiar... 5 | 6 | * If you don’t want to type the entire text of each of the Git commands, you can easily set up an alias for each command using `git config`. Here are a couple of examples you may want to set up: 7 | + 8 | git config --global alias.co checkout 9 | git config --global alias.br branch 10 | git config --global alias.ci commit 11 | git config --global alias.st status 12 | + 13 | This means that, for example, instead of typing `git commit`, you just need to type `git ci`. As you go on using Git, you’ll probably use other commands frequently as well; don’t hesitate to create new aliases. 14 | 15 | * An alias can be given to the remote link:#_repository[repo] as well, to make pulling and pushing easier. 16 | ** You can set custom aliases if you add a remote (ie, remote repo) using link:#_git_remote[`git remote`]. 17 | ** If you clone a repo using link:#_git_clone[`git clone`], the default alias of the remote repo is `origin`. 18 | 19 | .Related 20 | **** 21 | * link:#_git_config[git config] 22 | * link:#_git_pull[git pull] 23 | * link:#_git_push[git push] 24 | * link:#_git_remote[git remote] 25 | * link:#_git_clone[git clone] 26 | * link:#_git_fetch[git fetch] 27 | **** 28 | 29 | ''' 30 | -------------------------------------------------------------------------------- /src/docinfo.html: -------------------------------------------------------------------------------- 1 | 5 | 9 | 10 | 11 | 12 | 13 | 17 | 18 | 22 | 23 | 24 | 25 | 29 | 30 | 31 | 32 | 33 | 34 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | git_basics 3 |
4 |
5 | A website for the basics of Git and GitHub-like services. 6 |
7 |
8 | View the PWA at HarshKapadia2.github.io/git_basics 9 |
10 | or 11 |
12 | 13 | Get it on Google Play 14 | 15 |

16 | 17 | ### Author's Sessions 18 | 19 | - [Git Basics - The basics of Git and GitHub!](https://talks.harshkapadia.me/git_basics) 20 | - [Git Internals - How Does Git Work!?](https://talks.harshkapadia.me/git_internals) 21 | - [Hacktoberfest, Open Source and Pull Requests](https://talks.harshkapadia.me/otc_open_source_hacktoberfest_2020) 22 | 23 | > To learn the internals of Git, refer to the [Git Internals](https://git.harshkapadia.me) PWA. 24 | 25 | ### Contributions 26 | 27 | - All contributions are most welcome! 28 | - View the [`CONTRIBUTING.md`](CONTRIBUTING.md) file for further instructions. 29 | 30 | ### Code of Conduct 31 | 32 | Please be mindful of the [Code of Conduct](CODE_OF_CONDUCT.md) while contributing and interacting. 33 | 34 |
35 | 36 | 37 | Created using Asciidoctor Jet. 38 |
39 | The Git logo belongs to Git and is used under the CC BY 3.0 license. 40 |
41 | -------------------------------------------------------------------------------- /src/content/terms/branches.adoc: -------------------------------------------------------------------------------- 1 | === Branches 2 | 3 | image::branches.png[alt="Branches", 600, 600] 4 | 5 | * In Git, branches are a part of everyday development process. 6 | * Git branches are effectively a pointer to a snapshot of changes. 7 | * When a new feature is to be added or a bug — no matter how big or how small has to be fixed, a new branch is created to encapsulate the changes. 8 | * This makes it harder for unstable code to get merged into the main code base, and it gives the chance to clean up the future history before merging it into the main branch. 9 | 10 | ==== Default Branch 11 | 12 | * The default branch is considered as the base branch. 13 | * It is usually the most up to date/stable code version. 14 | * Importance 15 | ** This is the branch that is cloned on running link:#_git_clone[`git clone`]. 16 | ** All pull requests are opened against this base branch unless any other branch is explicitly specified. 17 | * Any branch can be made the default branch, but by default it is the 'master' (link:#_main_vs_master_1[or 'main']) branch. 18 | * The default branch can be changed at any time on GitHub from the link:#_repository[repository's] settings and GitHub will point all open pull requests to the new default branch. 19 | * link:#_change_default_branch_name[Changing the default branch of the local Git client (using `git config`)] is also possible. If this is done, whenever a new repository is link:#_git_init[initialized] locally, the default branch will be the new branch name entered in the `git config` command. 20 | 21 | .Related 22 | **** 23 | * link:#_git_branch[git branch] 24 | * link:#_git_checkout[git checkout] 25 | * link:#_git_restore[git restore] 26 | * link:#_git_switch[git switch] 27 | * link:#_git_merge[git merge] 28 | **** 29 | 30 | ''' 31 | -------------------------------------------------------------------------------- /src/content/contributor_friendly_repo/license.adoc: -------------------------------------------------------------------------------- 1 | === License 2 | 3 | * An open source license protects contributors and users. Businesses and savvy developers won’t touch a project without this protection. 4 | * link:https://opensource.guide/legal/#why-do-people-care-so-much-about-the-legal-side-of-open-source[The need for an open source license^]. 5 | * The license under which a project is released can be changed at any time. 6 | * it’s hard to go wrong with the link:https://choosealicense.com/licenses/mit/[MIT license^] as it’s short, very easy to understand and allows anyone to do anything so long as they keep a copy of the license, including the repository owner's copyright notice. 7 | * A good place to choose a license is https://choosealicense.com/[role=external,window=_blank]. 8 | * A commonly used license can be added directly from the 'Community' tab in the 'Insights' section of a repository. If the license is not present in the license section, a file called `LICENSE` (without an extension) can be created and the content of the license can be pasted in it. (The contents can be found at https://choosealicense.com/[role=external,window=_blank].) 9 | 10 | [WARNING] 11 | ==== 12 | If certain software doesn’t have a license, that generally means that there is no permission from the creators of the software to use, modify or share the software. Although a code host such as GitHub may allow viewing and forking the code, this does not imply that anyone is permitted to use, modify, or share the software for any purpose. 13 | 14 | The options are 15 | 16 | * Ask the maintainers nicely to add a license. 17 | * Don’t use the software. 18 | * Negotiate a private license with a lawyer. 19 | ==== 20 | 21 | link:https://eddiejaoude.github.io/book-open-source-tips/#_licensing[Source of above warning^] 22 | 23 | ''' 24 | -------------------------------------------------------------------------------- /src/content/contributor_friendly_repo/readme.adoc: -------------------------------------------------------------------------------- 1 | === README.md 2 | 3 | * The `README.md` file is where all the details of the project are written. 4 | * `md` stands for 'Markdown', which is a lightweight and very easy to learn markup language to create rich text using a plain text editor. 5 | ** link:https://www.youtube.com/watch?v=HUBNt18RFbo[Video to learn the syntax^]. 6 | ** link:https://github.com/tchapi/markdown-cheatsheet[Markdown cheat sheet^]. 7 | * A `README.md` file usually includes a brief description of the project with its features, a link to the link:#_contributing_md[`CONTRIBUTING.md`] file, a link to the link:#_code_of_conduct[`CODE_OF_CONDUCT`] file, a link to the link:#_license[`LICENSE`] file and any other section that the repository owner wants to add. 8 | * Sample template 9 | 10 | [source, markdown] 11 | ---- 12 | # repo name (or logo/picture) 13 | 14 | 15 | 16 | 17 | Description of project 18 | 19 | ## Features 20 | 21 | Describe the features of your project. 22 | 23 | ## Technologies used 24 | 25 | List all the technologies used 26 | 27 | ## Installation 28 | 29 | Give steps to install and use your software/project. (Not for contribution purposes.) 30 | 31 | ## Contributions 32 | 33 | Welcome all contributions & add a link to the `CONTRIBUTING.md` file. 34 | 35 | ## Code of Conduct 36 | 37 | Add a link to the `CODE_OF_CONDUCT.md` file. 38 | ---- 39 | 40 | NOTE: link:https://github.com/HarshKapadia2/attendance_management/blob/master/README.md[Source of the above template^]. 41 | 42 | * Badges/shields can be found/made at https://shields.io/[role=external,window=_blank]. 43 | * For a sample README.md template and more information in READMEs, refer to https://www.makeareadme.com/[role=external,window=_blank]. 44 | 45 | ''' 46 | -------------------------------------------------------------------------------- /src/content/general_1/repos_&_types.adoc: -------------------------------------------------------------------------------- 1 | === Repositories & its types 2 | 3 | * link:#_repository[What is a repository (repo)?] 4 | 5 | * Types of repos 6 | ** Local repo 7 | ** Remote repo 8 | *** Public repo 9 | *** Private repo 10 | 11 | * *Local repo* 12 | ** Local repository is the repo on the local machine (eg: laptop). 13 | ** The local repository has exactly the same features and functionality as any other Git repository. 14 | ** So a Git repo on a local machine (eg: your laptop) is the same as a git repo on GitHub (granted GitHub adds additional features, but at its core they're both Git repos) which is the same as your coworker's local repo. 15 | ** The local repo is everything in your '.git' directory. Mainly what is seen in the local repo are all of the user's checkpoints or commits. It is the area that saves everything (so don’t delete it). 16 | ** `touch` 17 | *** To create a file in the directory to which the bash is pointing. 18 | *** `touch ` 19 | *** Eg: `touch create_this_file.txt` 20 | 21 | NOTE: A local repo does not need to have a remote repo. 22 | 23 | * *Remote repo* 24 | ** Remote repository is the repo on the server. 25 | ** So while most people treat a particular repo as the central repo (the one on link:#_what_is_github[GitHub]), that's a process choice, not a Git requirement. 26 | ** A remote repo and local repo connection is handled using the link:#_git_remote[`git remote`] command. 27 | ** It can be of two types 28 | *** Local repo 29 | *** Remote repo 30 | 31 | + 32 | For more information on remote repos, refer to link:#_github_repositories[Repository (repo)] section. 33 | 34 | .Related 35 | **** 36 | * link:#_repository[Repository (repo)] 37 | * link:#_what_is_github[GitHub] 38 | **** 39 | 40 | ''' 41 | -------------------------------------------------------------------------------- /src/content/github/github_repositories.adoc: -------------------------------------------------------------------------------- 1 | === GitHub Repositories 2 | 3 | * link:#_repository[What is a repository (repo)?] 4 | 5 | * link:#_collaborators[Who are collaborators?] 6 | 7 | * link:#_contributors[Who are contributors?] 8 | 9 | * There are two types of repositories on GitHub (These are link:#_repositories_its_types[remote repos]) 10 | ** Public repo 11 | ** Private repo 12 | 13 | * *Public repo* 14 | ** A public repository is a repo open for the world to view, download and use (ethically or unethically, depending upon the [license]). 15 | ** Contributors can raise [issues] on the repo and make a [pull request (PR)] to it. 16 | ** Collaborators and the owner can raise [issues] on the repo and push code to it. 17 | ** It is a good way to improve the software and help others by showcasing the code and features as well! 18 | ** A GitHub free user is allowed to make unlimited public repos with unlimited collaborators. (There is a limit on the number of collaborators that can be added by the owner/organisation in 24 hours.) 19 | 20 | * *Private repo* 21 | ** A private repo is only open for viewing, downloading and uploading for the collaborator that the repo owner chooses. 22 | ** A private repo will only have collaborators as contributors. Contributors can raise [issues] on the repo and make a [pull request (PR)] to it. 23 | ** Collaborators and the owner can raise [issues] on the repo and push code to it. 24 | ** This type of repo is usually used to work on a project with or without a team, privately. 25 | ** A GitHub free user is allowed to make unlimited private repos with unlimited collaborators. (There is a limit on the number of collaborators that can be added by the owner/organisation in 24 hours.) 26 | 27 | .Related 28 | **** 29 | * link:#_repository[Repository (repo)] 30 | * link:#_repositories_its_types[Repos & types] 31 | **** 32 | 33 | ''' 34 | -------------------------------------------------------------------------------- /.github/workflows/build-deploy-website.yaml: -------------------------------------------------------------------------------- 1 | name: Build and deploy website 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | paths: 8 | - ".github/workflows/**" 9 | - "src/**" 10 | - build.sh 11 | pull_request: 12 | branches: 13 | - main 14 | paths: 15 | - ".github/workflows/**" 16 | - "src/**" 17 | - build.sh 18 | workflow_dispatch: # Allows manual execution of workflow 19 | 20 | jobs: 21 | build-website: 22 | if: startsWith(github.ref, 'refs/pull/') 23 | runs-on: ubuntu-latest 24 | container: "docker://asciidoctor/docker-asciidoctor:latest" 25 | steps: 26 | - name: Checkout code 27 | uses: actions/checkout@v4 28 | 29 | - name: Build site using Asciidoctor 30 | run: | 31 | # Give execution permission to buildscript 32 | chmod +x build.sh 33 | 34 | # Run buildscript 35 | ./build.sh 36 | 37 | build-deploy-website: 38 | if: startsWith(github.ref, 'refs/heads/') 39 | runs-on: ubuntu-latest 40 | container: "docker://asciidoctor/docker-asciidoctor:latest" 41 | steps: 42 | - name: Checkout code 43 | uses: actions/checkout@v3 44 | 45 | - name: Build site using Asciidoctor 46 | run: | 47 | # Give execution permission to buildscript 48 | chmod +x build.sh 49 | 50 | # Run buildscript 51 | ./build.sh 52 | 53 | - name: Install package for Deploy Action 54 | run: | 55 | apk update 56 | apk add rsync 57 | 58 | - name: Deploy to GitHub Pages 59 | uses: JamesIves/github-pages-deploy-action@v4 60 | with: 61 | branch: gh-pages 62 | folder: build 63 | clean: true 64 | -------------------------------------------------------------------------------- /src/content/commands/git_checkout.adoc: -------------------------------------------------------------------------------- 1 | === git checkout 2 | 3 | ==== Command 4 | 5 | `git checkout ` 6 | 7 | ==== Prerequisites 8 | 9 | The following terms are required to be understood: 10 | 11 | * link:#_head[HEAD] 12 | * link:#_branches[Branches] 13 | 14 | ==== Description 15 | 16 | The git checkout command operates upon three distinct entities: files, commits, and branches. 17 | 18 | The git checkout command lets you navigate between the branches created by link:#_git_branch[`git branch`]. 19 | 20 | https://www.atlassian.com/git/tutorials/using-branches/git-checkout[Further details^]. 21 | 22 | ==== Options/Flags 23 | 24 | ===== 25 | 26 | * Switches to / views / checks out a branch with the name `new_branch_name`. 27 | * Eg: `git checkout feature_branch` 28 | 29 | NOTE: link:#_git_switch[`git switch`] can also be used to achieve the same result. 30 | 31 | ===== -b 32 | 33 | * Creates a new branch & checks it out (switches to it) as well. 34 | 35 | NOTE: The new branch is created from the curent HEAD. 36 | 37 | ===== -b 38 | 39 | * Creates a new branch & checks it out (switches to it) as well. 40 | 41 | NOTE: The new branch is created from the last commit of the `existing_branch_name`. 42 | 43 | ===== 44 | 45 | * You can checkout a specific commit. 46 | 47 | NOTE: This condition will land you in a link:#_head[detached HEAD] state. 48 | 49 | ===== 50 | 51 | * To replace a modified file in the working directory/copy with the added/committed state version of that file. 52 | * If there are no staged changes, then the copy of the file in the local link:#_repository[repository] is used, otherwise the current file is overwritten by the staged copy of the file. 53 | 54 | NOTE: link:#_git_restore[`git restore`] can also be used to achieve the same result. 55 | 56 | .Related 57 | **** 58 | * link:#_git_merge[git merge] 59 | * link:#_git_branch[git branch] 60 | * link:#_git_restore[git restore] 61 | * link:#_git_switch[git switch] 62 | **** 63 | 64 | ''' 65 | -------------------------------------------------------------------------------- /src/content/general_2/checking_out_remote_branch.adoc: -------------------------------------------------------------------------------- 1 | === Checkout a Remote Branch 2 | 3 | There can be a situation in which a branch exists on the remote repo, but not in the local repo. 4 | 5 | .Two branches in the remote repository 6 | image::gh-branch-list-1.png[alt="Branches on GitHub", 400, 400] 7 | .Only one branch in the local repository 8 | image::branch-1.png[alt="Local branches", 600, 600] 9 | 10 | * In such a situation, the remote branch needs to be link:#_description_11[fetched] locally and then link:#_git_checkout[checked out] to be used locally. 11 | 12 | * There are two possibilities 13 | ** The remote branch has already been fetched locally, but not checked out. 14 | ** The remote branch has not been fetched. 15 | 16 | * To check whether the remote branch has been fetched locally or not, run link:#_a[`git branch -a`]. *If the branch is listed in red, then it has been fetched locally.* 17 | 18 | ==== If the Branch has been Fetched Locally 19 | 20 | .'br_1' (in red) has already been fetched 21 | image::branch-2.png[alt="Local and fetched remote branches", 600, 600] 22 | 23 | * Run `git checkout ` or `git switch ` to switch to the fetched remote branch. 24 | 25 | .Successfully switched to 'br_1'! 26 | image::branch-3.png[alt="Local and fetched remote branches", 600, 600] 27 | 28 | ==== If the Branch has not been Fetched Locally 29 | 30 | .'br_1' has been not been fetched (not in list) 31 | image::branch-4.png[alt="Local and fetched remote branches", 600, 600] 32 | 33 | * Fetch the branch using `git fetch `. 34 | 35 | image::fetch-1.png[alt="Fetched remote branch", 600, 600] 36 | 37 | * Run `git branch -a` to check whether it appears as a fetched branch in red. 38 | 39 | image::branch-2.png[alt="Local and fetched remote branches", 600, 600] 40 | 41 | * Run `git checkout ` or `git switch ` to switch to the fetched remote branch. 42 | 43 | .Successfully switched to 'br_1'! 44 | image::branch-3.png[alt="Local and fetched remote branches", 600, 600] 45 | 46 | ''' 47 | -------------------------------------------------------------------------------- /src/content/commands/git_branch.adoc: -------------------------------------------------------------------------------- 1 | === git branch 2 | 3 | ==== Command 4 | 5 | `git branch ` 6 | 7 | ==== Prerequisites 8 | 9 | The following term is required to be understood: 10 | 11 | * link:#_branches[Branches] 12 | 13 | ==== Description 14 | 15 | The `git branch` command lets the user create, list, rename and delete branches. 16 | 17 | It doesn’t let the user switch between branches or put a forked history back together again. For this reason, git branch is tightly integrated with the link:#_git_checkout[`git checkout`] and link:#_git_merge[`git merge`] commands. 18 | 19 | https://www.atlassian.com/git/tutorials/using-branches[Further details^]. 20 | 21 | ==== Options/Flags 22 | 23 | ===== --list or 24 | 25 | * List all of the local branches in the local link:#_repository[repository]. 26 | 27 | ===== -a 28 | 29 | * Lists all, ie, local and fetched remote branches. 30 | 31 | ===== 32 | 33 | * Creates a new branch, but this does not check out the new branch. 34 | * Use link:#_git_switch[`git switch`] or link:#_git_checkout[`git checkout`] to check out (view/switch to) the new branch. 35 | 36 | ===== -d 37 | 38 | * Delete the specified branch. 39 | 40 | TIP: If the currently checked out branch is to be deleted, link:#_git_checkout[switch to a different branch] and then run the above command. 41 | 42 | NOTE: This is a safe operation as Git prevents the deletion of the branch if it has unmerged changes. 43 | 44 | ===== -D 45 | 46 | * Force delete the specified branch, even if it has unmerged changes. 47 | 48 | TIP: If the currently checked out branch is to be deleted, link:#_git_checkout[switch to a different branch] and then run the above command. 49 | 50 | ===== '-m ' or '-M ' 51 | 52 | * Rename the current branch to `new_branch_name`. 53 | 54 | ===== --show-current 55 | 56 | * Print the current name of the branch. 57 | * Does not print anything in the link:#_detached_head[detached HEAD] state. 58 | 59 | .Related 60 | **** 61 | * link:#_git_merge[git merge] 62 | * link:#_git_checkout[git checkout] 63 | **** 64 | 65 | ''' 66 | -------------------------------------------------------------------------------- /src/content/misc/resources.adoc: -------------------------------------------------------------------------------- 1 | === Resources 2 | 3 | ==== Sessions by the Author 4 | 5 | * link:https://talks.harshkapadia.me/git_basics[Git Basics - The basics of Git and GitHub!^] 6 | * link:https://talks.harshkapadia.me/git_internals[Git Internals - How Does Git Work!?^] 7 | * link:https://talks.harshkapadia.me/otc_open_source_hacktoberfest_2020[Hacktoberfest, Open Source and Pull Requests^] 8 | 9 | ==== Getting Started with Git and GitHub 10 | 11 | * link:https://www.youtube.com/watch?v=SWYqp7iY_Tc[Crash course by Brad Traversy^] 12 | 13 | ==== Contribution Help 14 | 15 | * link:https://github.com/firstcontributions/first-contributions[Learn how to make a Pull Request (PR)^] 16 | 17 | ===== GitHub Issues 18 | 19 | * Search for `good-first-issue` and `first-timers-only` issues on GitHub in the language/library/framework of choice. 20 | * link:https://github.com/search?q=label%3Afirst-timers-only+is%3Aopen&type=Issues['first-timers-only' issues on GitHub^] 21 | * link:https://github.com/search?q=label%3Agood-first-issue+is%3Aopen&type=Issues['good-first-issue' issues on GitHub^] 22 | 23 | ==== Visualization 24 | 25 | * link:https://git-graph.harshkapadia.me[Git Graph: Visualize Commit, Tree and Blob objects^] 26 | * link:http://git-school.github.io/visualizing-git[Visualize a commit graph^] 27 | 28 | ==== Documentation 29 | 30 | * link:https://www.atlassian.com/git[Git Docs by Atlassian^] 31 | * link:https://www.git-scm.com/docs[Official Git documentation^] 32 | * link:https://www.git-scm.com/book/en/v2[Pro Git (v2)^] 33 | 34 | ==== Browser Extensions for GitHub 35 | 36 | * link:https://github.com/sindresorhus/refined-github#install[Refined GitHub^] 37 | ** Simplifies the GitHub interface and adds useful features. 38 | * link:https://gitzip.org/#extension[GitZip for GitHub^] 39 | ** Only download required directories/files from GitHub repos. 40 | * link:https://www.octotree.io/download[Octotree^] 41 | ** Add a navigation pane to the left of a GitHub repo to navigate it easily. 42 | 43 | ==== Articles 44 | 45 | * link:https://dev.to/lydiahallie/cs-visualized-useful-git-commands-37p1[CS Visualized: Useful Git Commands^] 46 | 47 | ==== Advanced 48 | 49 | * link:https://git.harshkapadia.me[Git Internals^] by the author. 50 | * link:https://talks.harshkapadia.me/git_internals[Git Internals - How Does Git Work!?^] (By the autor.) 51 | 52 | ''' 53 | -------------------------------------------------------------------------------- /src/content/commands/git_status.adoc: -------------------------------------------------------------------------------- 1 | === git status 2 | 3 | ==== Commands 4 | 5 | `git status` 6 | 7 | ==== Prerequisites 8 | 9 | The following terms are required to be understood: 10 | 11 | * link:#_untracked_files[Untracked files] 12 | * link:#_added_files[Added files] 13 | * link:#_modified_files[Modified files] 14 | * link:#_staging_staging_areaindex[Staging (staging area/index)] 15 | * link:#_working_tree[Working tree] 16 | 17 | ==== Description 18 | 19 | * Run this command at any time to display the current status of the working directory. 20 | * This command shows two things: 21 | ** The files in your Working Tree (untracked and modified files) 22 | ** The files in your Staging Area (added files) 23 | 24 | ==== Options/Flags 25 | 26 | ===== -s or --short 27 | 28 | * Gives a summary of untracked and staged (added) files. 29 | * Meanings of different symbols 30 | ** `??` implies an untracked file, ie, a file that has never been staged. 31 | ** `A` implies a newly staged (added) file, ie, a file that is now staged, but has never been staged before. 32 | ** `M (red)` implies unstaged modifications in a committed file. 33 | ** `M (green)` implies staged modifications in a committed file (but the new modifications have not been committed yet). 34 | ** `AM (green and red respectively)` implies new modifications in a newly staged uncommitted file. 35 | ** `MM (green and red respectively)` implies new modifications in a committed file that has been staged with modifications, without committing the previous changes. 36 | ** `D (red)` implies the renaming/moving/both (renaming and moving)/deletion of a staged file that has not been staged again. 37 | ** `D (green)` implies the deletion of a staged file. 38 | ** `R (green)` implies the renaming/moving/both of a staged file. 39 | ** `AD (green and red respectively)` implies the renaming/moving/both (renaming and moving)/deletion of a newly staged uncommitted file that has not been staged again. 40 | 41 | [NOTE] 42 | ==== 43 | * Once a file is renamed, moved or both renamed and moved, it is marked as deleted (red coloured `D`) by Git and a new untracked file (red coloured `??`) is shown in its place when `git status -s` is run. Once the link:#_git_add[`git add`] command is run once again, Git realises that the file has been renamed/moved/both and displays a green coloured `R` when `git status -s` is run again. 44 | * If `AD` is displayed, the newly staged file can have been renamed, moved, both (renamed and moved) or deleted. In the case of renaming, moving or both, the original file gets forgotten in the next staging and the new file is added. In the case of deletion, the file is simply forgotten in the next staging. 45 | ==== 46 | 47 | ''' 48 | -------------------------------------------------------------------------------- /src/content/commands/git_config.adoc: -------------------------------------------------------------------------------- 1 | === git config 2 | 3 | ==== Command 4 | 5 | `git config ` 6 | 7 | ==== Prerequisites 8 | 9 | The following terms are required to be understood: 10 | 11 | * link:#_branches[Branches] 12 | * link:#_aliases[Aliases] 13 | * link:#_repository[Repository (repo)] 14 | 15 | ==== Description 16 | 17 | Get and set repository or global options. 18 | 19 | ==== Options/Flags 20 | 21 | ===== --global 22 | 23 | * Modify Git's global (system-wide) configuration. These settings affect all Git repositories on a system. 24 | * Set user's name: `git config --global user.name ""` 25 | * Set user's e-mail: `git config --global user.email ""` 26 | 27 | [NOTE] 28 | ==== 29 | * It is mandatory to fill in these two details. 30 | * Please enter the e-mail ID registered with the concerned GitHub/GitLab/BitBucket account and the full name. 31 | * This is the name and e-mail ID that will be associated with each commit. 32 | * The global name and e-mail need to be set just once, ie, when Git is used for the first time ever on a computer (but can be modified if need be). 33 | ==== 34 | 35 | [#_change_default_branch_name] 36 | * Change default branch name created on running link:#_git_init[`git init`] command: `git config --global init.defaultBranch ""` 37 | 38 | [TIP#_main_vs_master_2] 39 | ==== 40 | 'main' vs 'master' #2: 41 | 42 | * link:#_main_vs_master_1['main' vs 'master' #1] 43 | * This only applies to GitHub repositories. 44 | * New GitHub repositories have the name of their link:#_default_branch[default branch] as 'main' instead of 'master', while the local Git client still uses 'master' as the name of the default branch when link:#_git_init[initializing repositories]. 45 | * This mismatch in the names of the default branches causes link:#_git_push[pushes] to new remote repositories to fail. 46 | * To combat this change on GitHub, it would be advisable to change the name of the default branch of the local Git client to 'main' using the command `git config --global init.defaultBranch "main"`. 47 | * NOTE: Cloned repositories will not be impacted unless the remote repository's default branch is changed on GitHub after cloning (in which case GitHub will provide commands to rename the local branch on visiting the repository page on GitHub for the first time after the renaming). 48 | ==== 49 | 50 | * Change the default editor for committing, rebasing and other Git operations 51 | ** Command: `git config --global core.editor ""` 52 | ** Some editor options 53 | *** Vim: `vim` 54 | *** VS Code: `code --wait` 55 | *** Sublime Text: `subl --wait` or `\"full/path/to/subl.exe\" -w` 56 | * link:#_aliases[Aliases can also be set] using this flag. 57 | 58 | ===== --list 59 | 60 | * Lists the configurations of Git. 61 | * Eg: `git config --list` 62 | 63 | ''' 64 | -------------------------------------------------------------------------------- /src/content/commands/git_merge.adoc: -------------------------------------------------------------------------------- 1 | === git merge 2 | 3 | ==== Command 4 | 5 | `git merge ` 6 | 7 | ==== Prerequisites 8 | 9 | The following terms are required to be understood: 10 | 11 | * link:#_head[HEAD] 12 | * link:#_branches[Branches] 13 | 14 | ==== Description 15 | 16 | The `git merge` command's primary responsibility is to combine separate branches and resolve any conflicting edits. 17 | 18 | Merging is Git's way of putting a forked history back together again. 19 | 20 | The `git merge` command lets you take the independent lines of development created by link:#_git_branch[`git branch`] or link:#_git_checkout[`git checkout`] and integrate them into a single branch. 21 | 22 | Preparing to merge: 23 | 24 | * Make sure to be in the branch (`link:#_git_checkout[git checkout] `) you want to merge another branch into (let this branch be called `receiving_branch`). 25 | * Make sure the receiving branch and the merging branch are up-to-date with the latest remote changes. 26 | * Merge using `git merge ` 27 | * Eg: If you want to merge the 'feature' branch into the 'master' branch, run `git checkout master` (if you aren't already in the master branch, ie, if your HEAD points to another branch) and then run `git merge feature`. 28 | 29 | NOTE: This *does not* create a new commit signifying the merge. 30 | 31 | NOTE: The branch can be safely deleted. 32 | 33 | Merges are of mainly two types: 34 | 35 | * Fast forward merges (usually for small and short develop-duration features) 36 | * Three way merges (usually for long ranging tasks and features) 37 | 38 | image::types-of-merges.jpg[alt="Types of merges", 600, 600] 39 | 40 | NOTE: link:#_git_push[`git push`] is allowed only if you have a fast forward merge. 41 | 42 | https://www.atlassian.com/git/tutorials/using-branches/git-merge[Further details^]. 43 | 44 | NOTE: link:#_merge_conflicts[Managing *merge conflicts* (using both CLIs and GUIs)]. 45 | 46 | ==== Options/Flags 47 | 48 | ===== --abort 49 | 50 | * This will exit from the merge process and return the branch to the state before the merge began. 51 | 52 | ===== --no-ff 53 | 54 | * If a fast forward merge is to be carried out, but even then create a new merge commit for the symbolic merging, this flag & option can be used. 55 | * The text editor will open for a message. Save the merge message and close the file in the editor to complete the merge. 56 | 57 | NOTE: This is useful for documenting all merges that occur in a repository, as a merge without this flag does not create a new commit. 58 | 59 | .Related 60 | **** 61 | * link:#_git_checkout[git checkout] 62 | * link:#_git_branch[git branch] 63 | * link:#_git_pull[git pull] 64 | * link:#_git_fetch[git fetch] 65 | * link:#_merge_conflicts[Merge Conflicts] 66 | * link:#_git_branch[git branch] 67 | **** 68 | 69 | ''' 70 | -------------------------------------------------------------------------------- /src/content/commands/git_clone.adoc: -------------------------------------------------------------------------------- 1 | === git clone 2 | 3 | ==== Command 4 | 5 | `git clone .git` 6 | 7 | [.word-break-all] 8 | Eg: 9 | 10 | * `git clone https://github.com/HarshKapadia2/git_basics.git` 11 | * `git clone ssh://username@hostname:port/absolute/path/to/repo` 12 | 13 | ==== Prerequisites 14 | 15 | The following terms are required to be understood: 16 | 17 | * link:#_aliases[Aliases] 18 | * link:#_repository[Repository (repo)] 19 | 20 | ==== Description 21 | 22 | Clone/copy an entire link:#_repositories_its_types[local or a remote repository] into the current directory (to which the CLI is pointing). 23 | 24 | A new directory will be created with the name of the repository. `cd` (change directory) into that directory to start using it. 25 | 26 | ==== Options/Flags 27 | 28 | ===== No option 29 | 30 | * The link:#_default_branch[default branch] of the local or remote repository will be cloned into a new directory with the same name as the repository. 31 | 32 | [.word-break-all] 33 | * Cloning a remote repository: `git clone https://github.com/HarshKapadia2/git_basics.git` 34 | * Cloning a local repository: `git clone x:/coding/git/local_repo` 35 | 36 | ===== -b or --branch 37 | 38 | * Clone only a specific branch of a remote repo. 39 | * It is useful to fetch the required branch quickly to fix the issues in a big project. 40 | 41 | [.word-break-all] 42 | * Eg: `git clone -b main https://github.com/HarshKapadia2/git_basics.git` or `git clone -b main --single-branch https://github.com/HarshKapadia2/git_basics.git` 43 | * `--single-branch` is assumed. 44 | 45 | ===== --depth 46 | 47 | * **Shallow clone** only upto a certain number of latest commits and history either in a `--single-branch` (default) or in all branches (`--no-single-branch`). 48 | * Specify the branch name using `-b` or `--branch` for `--single-branch`. The `main` (previously called `master`) branch is assumed, if not specified. 49 | 50 | [.word-break-all] 51 | * Eg: `git clone -b v2 --depth 1 https://github.com/HarshKapadia2/attendance_manager.git` 52 | * With `--no-single-branch`, use link:#_git_branch[`git branch -a`] to view the fetched branches and link:#_git_switch[`git switch `] to use it. 53 | * Eg: `git clone --no-single-branch --depth 1 https://github.com/HarshKapadia2/attendance_manager.git` 54 | 55 | WARNING: link:https://stackoverflow.com/a/28985327/11958552[Shallow clones cannot be pushed to a new repository^]. The shallow clone will either have to be [unshallowed] or the link:https://git.harshkapadia.me/#_the_git_directory[`.git` directory^] will have to be deleted (start afresh by link:#_git_init[initializing a new repository]). 56 | 57 | .Related 58 | **** 59 | * link:https://www.ithands.com/blog/advanced-git-features/#:~:text=Cloning%20a%20Specific%20Branch[`-b` reference^] 60 | * link:https://linuxhint.com/git-shallow-clone-and-clone-depth[Shallow clone reference^] 61 | **** 62 | 63 | ''' 64 | -------------------------------------------------------------------------------- /src/content/general_2/fork_syncing.adoc: -------------------------------------------------------------------------------- 1 | === Sync a Fork with its Original Repo 2 | 3 | * Once a repository (repo) is [forked], the forked repo does not receive the latest commits in the original repo. 4 | 5 | * To get those new changes, the forked repo has to be synced with the original repo. 6 | 7 | [NOTE] 8 | ==== 9 | * GitHub has now made syncing a [forked repo] with its original repo very easy. 10 | 11 | * The GUI has buttons to directly do it (as shown in the image below, Fetch upstream -> Fetch and merge). The changes in the synced forked repo only have to be link:#_git_pull[pulled] to reflect locally. 12 | 13 | image::fork-syncing.png[alt="GitHub repo: Fetch upstream -> Fetch and merge", 600, 600] 14 | 15 | * The steps below will still work, but are unnecessary for repositories on GitHub. 16 | ==== 17 | 18 | * Steps to be followed 19 | 20 | ** Connect the link:#_repositories_its_types/:~:text=local%20repo[local] forked repo with the original link:link:#_repositories_its_types/:~:text=remote%20repo[remote] repo. 21 | 22 | *** Run link:#_git_remote/:~:text=-v[`git remote -v`] to list all the remote repos connected to the local forked repo. 23 | 24 | *** Add the original (remote) repo as a remote to the local forked repo using link:#_git_remote/:~:text=add%20%20.git[`git remote add originalRepo .git`]. 25 | 26 | **** The link:#_aliases/:~:text=An%20alias%20can%20be%20given%20to%20the%20remote%20repo[alias] for the original remote repo is assumed to be `originalRepo` here. 27 | 28 | *** Run link:#_git_remote/:~:text=-v[`git remote -v`] again to check whether it has been added. 29 | 30 | *** The original repo is now connected to the local forked repo. 31 | 32 | ** Get the latest changes in the original repo and push the to your forked (remote) repo. 33 | 34 | *** Run link:#_git_pull[`git pull originalRepo `] to get the latest changes from the original repo. 35 | 36 | **** If there are link:#_merge_conflicts[merge conflicts], they have to be handled. 37 | 38 | *** Push the changes to the remote forked repo using link:#_git_push[`git push -u origin `]. 39 | 40 | **** The link:#_aliases/:~:text=An%20alias%20can%20be%20given%20to%20the%20remote%20repo[alias] for the remote forked repo is assumed to be `origin` here. 41 | 42 | NOTE: The `git pull` step can be split into `git fetch` & `git merge` as well. 43 | 44 | * Summary of the important commands to sync a fork 45 | 46 | [source, shell] 47 | ---- 48 | $ git remote add originalRepo .git 49 | $ git pull originalRepo 50 | $ git push -u origin 51 | ---- 52 | 53 | (where `originalRepo` = original remote repo alias & `origin` = remote forked repo alias) 54 | 55 | .Related 56 | **** 57 | * https://medium.com/@john_pels/sync-your-git-fork-to-the-original-repo-a57d5084e20e[Reference article^] 58 | **** 59 | 60 | ''' 61 | -------------------------------------------------------------------------------- /src/static/highlight/styles/github-light-dark.min.css: -------------------------------------------------------------------------------- 1 | /* ========================================================= LIGHT MODE ========================================================= */ 2 | /* Taken from: https://github.com/highlightjs/highlight.js/blob/main/src/styles/github.css */ 3 | .hljs{color:#24292e;background:#ffffff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#005cc5}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-code,.hljs-comment,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:bold}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:bold}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}.hljs-char.escape_,.hljs-link,.hljs-params,.hljs-property,.hljs-punctuation,.hljs-tag{} 4 | /* ========================================================= DARK MODE ========================================================= */ 5 | /* Taken from: https://github.com/highlightjs/highlight.js/blob/main/src/styles/github-dark.css */ 6 | body.dark .hljs{color:#c9d1d9;background:#0d1117}body.dark .hljs-doctag,body.dark .hljs-keyword,body.dark .hljs-meta .hljs-keyword,body.dark .hljs-template-tag,body.dark .hljs-template-variable,body.dark .hljs-type,body.dark .hljs-variable.language_{color:#ff7b72}body.dark .hljs-title,body.dark .hljs-title.class_,body.dark .hljs-title.class_.inherited__,body.dark .hljs-title.function_{color:#d2a8ff}body.dark .hljs-attr,body.dark .hljs-attribute,body.dark .hljs-literal,body.dark .hljs-meta,body.dark .hljs-number,body.dark .hljs-operator,body.dark .hljs-selector-attr,body.dark .hljs-selector-class,body.dark .hljs-selector-id,body.dark .hljs-variable{color:#79c0ff}body.dark .hljs-meta .hljs-string,body.dark .hljs-regexp,body.dark .hljs-string{color:#a5d6ff}body.dark .hljs-built_in,body.dark .hljs-symbol{color:#ffa657}body.dark .hljs-code,body.dark .hljs-comment,body.dark .hljs-formula{color:#8b949e}body.dark .hljs-name,body.dark .hljs-quote,body.dark .hljs-selector-pseudo,body.dark .hljs-selector-tag{color:#7ee787}body.dark .hljs-subst{color:#c9d1d9}body.dark .hljs-section{color:#1f6feb;font-weight:bold}body.dark .hljs-bullet{color:#f2cc60}body.dark .hljs-emphasis{color:#c9d1d9;font-style:italic}body.dark .hljs-strong{color:#c9d1d9;font-weight:bold}body.dark .hljs-addition{color:#aff5b4;background-color:#033a16}body.dark .hljs-deletion{color:#ffdcd7;background-color:#67060c}body.dark .hljs-char.escape_,body.dark .hljs-link,body.dark .hljs-params,body.dark .hljs-property,body.dark .hljs-punctuation,body.dark .hljs-tag{} -------------------------------------------------------------------------------- /src/content/commands/git_add.adoc: -------------------------------------------------------------------------------- 1 | image::git-local-remote.png[alt="Git local & remote commands chart #1", 600, 600] 2 | 3 | ''' 4 | 5 | === git add 6 | 7 | ==== Command 8 | 9 | `git add ` where `ext`stands for the extension of the file. 10 | 11 | ==== Prerequisites 12 | 13 | The following terms are required to be understood: 14 | 15 | * link:#_untracked_files[Untracked files] 16 | * link:#_added_files[Added files] 17 | * link:#_modified_files[Modified files] 18 | * link:#_gitignore_file[.gitignore file] 19 | * link:#_staging_staging_areaindex[Staging (staging area/index)] 20 | * link:#_working_tree[Working tree] 21 | 22 | ==== Description 23 | 24 | To add files to the staging area (refer to picture above). 25 | 26 | ==== Options/Flags 27 | 28 | ===== 29 | 30 | * Adds a single file to the staging area. 31 | * If file is located in a folder, use `directory_name/` 32 | * Multiple file names in one command are allowed with a whitespace in between them. 33 | * Eg: `git add dir/dir1_file.txt` 34 | 35 | ===== *.ext 36 | 37 | * All files with '.ext' extension will be added to the staging area (except for the file names in the .gitignore file). 38 | 39 | ===== . (period) 40 | 41 | * Eg: `git add .` 42 | * Recursive command to send all untracked and modified files to the staging area (except for the file names in the .gitignore file). 43 | 44 | ===== -p or --patch 45 | 46 | * Enables choosing the staging of specific hunks (group of lines/chunks) of files instead of entire files. 47 | * It presents the diff between the index (staging area) and the working tree file and asks what one wants to do with the change of each hunk. 48 | * Using this flag makes Git display hunks one by one and bring up command options for every hunk to 49 | ** `y` (yes): Stage the hunk. 50 | ** `n` (no): Not stage the hunk. 51 | ** `q` (quit): Quit the process and not stage the current hunk or the **remaining** ones. (Hunks in order can be left undecided temporarily as seen in the options below.) 52 | ** `a` (all): Stage the current hunk all the ones that follow. 53 | ** `d` (delete): Not stage the current hunk all the ones that **follow**. 54 | ** `g` (goto): Go to a particular hunk. (It will display a list with a hunk number to go to a particular hunk if there are more than 1 hunks.) 55 | ** `/`: Search for a hunk matching the given regex. 56 | ** `j`: Leave the current hunk undecided and see the next undecided hunk. 57 | ** `J`: Leave the current hunk undecided and see the next hunk. 58 | ** `k`: Leave the current hunk undecided and see the previous undecided hunk. 59 | ** `K`: Leave the current hunk undecided and see the previous hunk. 60 | ** `s` (split): Split the current hunk into smaller hunks. 61 | ** `e` (edit): Manually edit the current hunk in an editor. 62 | ** `?`: Print help. 63 | * Eg: `git add -p` or `git add -p ` 64 | 65 | ===== -n . 66 | 67 | * Eg: `git add -n .` 68 | * Shows files that will be added, but does not add them. 69 | * Run other `git add` commands to actually add files to the staging area. 70 | 71 | ===== -u 72 | 73 | * Stages modified and deleted files, without including new (untracked) files. 74 | 75 | .Related 76 | **** 77 | * link:#_git_rm[Remove staged (added) files (`git rm`)] 78 | * link:#_unstage_files_stagedadded_by_mistake[Unstage Files Staged/Added by Mistake] 79 | **** 80 | 81 | ''' 82 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | - Using welcoming and inclusive language 18 | - Being respectful of differing viewpoints and experiences 19 | - Gracefully accepting constructive criticism 20 | - Focusing on what is best for the community 21 | - Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | - The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | - Trolling, insulting/derogatory comments, and personal or political attacks 28 | - Public or private harassment 29 | - Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | - Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at harshgkapadia@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /src/index.adoc: -------------------------------------------------------------------------------- 1 | = git_basics 2 | Harsh Kapadia 3 | v3 4 | :author: Harsh Kapadia 5 | :toc: left 6 | :favicon: ./static/img/favicon.ico 7 | :imagesdir: ./static/img 8 | :icons: image 9 | :iconsdir: ./static/img/admonition_icons 10 | :docinfo: shared 11 | :sectanchors: 12 | :figure-caption!: 13 | :source-highlighter: highlight.js 14 | :highlightjsdir: ./static/highlight 15 | :highlightjs-theme: github-light-dark 16 | :nofooter: 17 | 18 | == Abstract 19 | 20 | A website for the basics of Git and GitHub-like services. 21 | 22 | == Preface 23 | 24 | The open source community is inclusive and friendly. Contributing to it is always exciting if done in the spirit of improving the community and enjoying oneself. 25 | 26 | Knowing the basics of Git and GitHub is the only prerequisite to start contributing and learning them sometimes feels like a daunting task. The aim of this guide is to help anyone get started with open source and keep helping them along their journey. 27 | 28 | *This project is open source* and the repository can be found at link:https://github.com/HarshKapadia2/git_basics[github.com/HarshKapadia2/git_basics^]. Contributions to keep it updated and error-free are appreciated and issues and pull requests are most welcome! 29 | 30 | For further questions, please feel free to contact the author, link:https://harshkapadia.me[Harsh Kapadia^], via link:https://ourtech.community[OTC^], link:https://twitter.com/harshgkapadia[Twitter^], link:https://www.linkedin.com/in/harshgkapadia[LinkedIn^] or e-mail (link:mailto:contact@harshkapadia.me[contact@harshkapadia.me^]). 31 | 32 | [IMPORTANT] 33 | ==== 34 | Git and GitHub sessions by the author: 35 | 36 | * link:https://talks.harshkapadia.me/git_basics[Git Basics - The basics of Git and GitHub!^] 37 | * link:https://talks.harshkapadia.me/git_internals[Git Internals - How Does Git Work!?^] 38 | * link:https://talks.harshkapadia.me/otc_open_source_hacktoberfest_2020[Hacktoberfest, Open Source and Pull Requests^] 39 | 40 | ==== 41 | 42 | NOTE: One might want to familiarize themselves with some link:#_terms[terms] before starting, although they will be linked at places where they are required as well. 43 | 44 | [NOTE#_main_vs_master_1] 45 | ==== 46 | 'main' vs 'master' #1: 47 | 48 | * This only applies to GitHub link:#_repositories[repositories]. 49 | * GitHub is gradually renaming the link:#_default_branch[default branch] of repositories from 'master' to 'main'. 50 | * The name of the default branch for new repositories on GitHub is now 'main'. 51 | * Existing repositories on GitHub are not impacted by this change, but they can now rename their branches if they wish to. 52 | * For more details, please check the https://github.com/github/renaming[renaming repo^] by GitHub. 53 | * link:#_change_default_branch_name[Changing the default branch of the local Git client] is also possible. 54 | * link:#_main_vs_master_2['main' vs 'master' #2] 55 | ==== 56 | 57 | == General #1 58 | 59 | include::./refs/general_1.adoc[] 60 | 61 | == Commands 62 | 63 | include::./refs/commands.adoc[] 64 | 65 | == General #2 66 | 67 | include::./refs/general_2.adoc[] 68 | 69 | == Correcting Common Mistakes 70 | 71 | include::./refs/correcting_common_mistakes.adoc[] 72 | 73 | == Git Internals 74 | 75 | Moved to link:https://git.harshkapadia.me[git.harshkapadia.me^]. 76 | 77 | include::./refs/git_internals.adoc[] 78 | 79 | == GitHub 80 | 81 | include::./refs/github_1.adoc[] 82 | 83 | == Contributor Friendly Repository 84 | 85 | include::./refs/contributor_friendly_repo.adoc[] 86 | 87 | == Terms 88 | 89 | include::./refs/terms.adoc[] 90 | 91 | == Misc 92 | 93 | include::./refs/misc.adoc[] 94 | 95 | ''' 96 | 97 | [quote, Selena Gomez] 98 | Kindness always wins. 99 | 100 | [quote, Robert Ingersoll] 101 | We rise by lifting others. 102 | 103 | [quote, Helen Keller] 104 | Alone we can do so little; Together we can do so much. 105 | 106 | ''' 107 | 108 | ++++ 109 | 116 | 117 | 118 | ++++ 119 | -------------------------------------------------------------------------------- /src/service-worker.js: -------------------------------------------------------------------------------- 1 | const cacheName = "v49"; 2 | const cacheAssets = [ 3 | "./", 4 | "./index.html", 5 | "./robots.txt", 6 | "./google66b7e1d4dbf56798.html", 7 | "./static/html/privacy_policy.html", 8 | "./static/css/style.css", 9 | "./static/js/main.js", 10 | "./static/img/admonition_icons/tip.png", 11 | "./static/img/admonition_icons/warning.png", 12 | "./static/img/admonition_icons/note.png", 13 | "./static/img/admonition_icons/caution.png", 14 | "./static/img/admonition_icons/important.png", 15 | "./static/img/add-1.jpg", 16 | "./static/img/add-2.jpg", 17 | "./static/img/add-3.jpg", 18 | "./static/img/add-to-master_file_1-1.jpg", 19 | "./static/img/branch-1.png", 20 | "./static/img/branch-2.png", 21 | "./static/img/branch-3.png", 22 | "./static/img/branch-4.png", 23 | "./static/img/branches.png", 24 | "./static/img/cat-1.jpg", 25 | "./static/img/cat-FETCH_HEAD-1.png", 26 | "./static/img/cat-FETCH_HEAD-2.png", 27 | "./static/img/cat-file-p-1.jpg", 28 | "./static/img/cat-file-p-2.jpg", 29 | "./static/img/cat-file-p-3.jpg", 30 | "./static/img/cat-file-p-4.jpg", 31 | "./static/img/cat-file-p-5.jpg", 32 | "./static/img/cat-file-p-6.jpg", 33 | "./static/img/cat-file-p-7.jpg", 34 | "./static/img/cat-file-p-8.jpg", 35 | "./static/img/cat-file-t-1.jpg", 36 | "./static/img/cat-logs.png", 37 | "./static/img/cat-packed-refs.png", 38 | "./static/img/clear_cross.svg", 39 | "./static/img/commit-master_file_1-1.jpg", 40 | "./static/img/connection-graph-1.png", 41 | "./static/img/connection-graph-2.png", 42 | "./static/img/connection-graph-3.png", 43 | "./static/img/connection-graph-4.png", 44 | "./static/img/cvcs.png", 45 | "./static/img/decompress-file.png", 46 | "./static/img/dir-1.jpg", 47 | "./static/img/dir-2.jpg", 48 | "./static/img/du-c-1.jpg", 49 | "./static/img/du-c-2.jpg", 50 | "./static/img/du-c-3.jpg", 51 | "./static/img/du-c-4.jpg", 52 | "./static/img/dvcs.png", 53 | "./static/img/edit-master_file_1-1.jpg", 54 | "./static/img/fast-forward-merge.png", 55 | "./static/img/favicon.ico", 56 | "./static/img/fetch-1.png", 57 | "./static/img/fork-syncing.png", 58 | "./static/img/gh-branch-list-1.png", 59 | "./static/img/git_basics_logo.svg", 60 | "./static/img/git-init.jpg", 61 | "./static/img/git-local-remote-2.png", 62 | "./static/img/git-local-remote.png", 63 | "./static/img/git-ls-files.png", 64 | "./static/img/git-push.jpeg", 65 | "./static/img/gsoc.png", 66 | "./static/img/gsod.png", 67 | "./static/img/head-1.jpg", 68 | "./static/img/icon-192x192.png", 69 | "./static/img/icon-512x512.png", 70 | "./static/img/index-explained.png", 71 | "./static/img/log-1.jpg", 72 | "./static/img/ls-a-1.jpg", 73 | "./static/img/lvcs.jpg", 74 | "./static/img/mkdir_1.jpg", 75 | "./static/img/mlh.png", 76 | "./static/img/moon.svg", 77 | "./static/img/mv-1.jpg", 78 | "./static/img/og-image.png", 79 | "./static/img/outreachy.png", 80 | "./static/img/sha1sum.png", 81 | "./static/img/sun.svg", 82 | "./static/img/the-linux-foundation.png", 83 | "./static/img/touch-master_file_1.jpg", 84 | "./static/img/touch-master_file_2.jpg", 85 | "./static/img/tree-1.png", 86 | "./static/img/types-of-merges.jpg", 87 | "./static/img/up-arrow.svg", 88 | "./static/img/verify-pack-1.jpg", 89 | "./static/img/working-of-commit.jpeg" 90 | ]; 91 | 92 | self.addEventListener("install", (e) => { 93 | // Cache files 94 | e.waitUntil( 95 | caches 96 | .open(cacheName) 97 | .then((cache) => cache.addAll(cacheAssets)) 98 | .then(() => self.skipWaiting()) 99 | .catch((err) => console.error(`Cache error: ${err}`)) 100 | ); 101 | }); 102 | 103 | self.addEventListener("activate", (e) => { 104 | e.waitUntil( 105 | // Delete any previous cache 106 | caches.keys().then((cacheKeys) => { 107 | return Promise.all( 108 | cacheKeys.map((cacheKey) => { 109 | if (cacheKey !== cacheName) return caches.delete(cacheKey); 110 | }) 111 | ); 112 | }) 113 | ); 114 | }); 115 | 116 | self.addEventListener("fetch", (e) => { 117 | e.respondWith( 118 | fetch(e.request) 119 | .then((response) => { 120 | const resClone = response.clone(); 121 | 122 | // Add response to cache 123 | if (e.request.url.indexOf("http") === 0) 124 | caches 125 | .open(cacheName) 126 | .then((cache) => cache.put(e.request, resClone)); 127 | 128 | return response; 129 | }) 130 | .catch((err) => 131 | caches.match(e.request).then((response) => response) 132 | ) 133 | ); 134 | }); 135 | -------------------------------------------------------------------------------- /src/content/commands/git_commit.adoc: -------------------------------------------------------------------------------- 1 | === git commit 2 | 3 | image::working-of-commit.jpeg[alt="Working of Commit", 600, 600] 4 | 5 | ==== Command 6 | 7 | `git commit ` 8 | 9 | ==== Prerequisites 10 | 11 | The following terms are required to be understood: 12 | 13 | * link:#_staging_staging_areaindex[Staging (staging area/index)] 14 | * link:#_sha1[SHA1] 15 | * link:#_head[HEAD] 16 | 17 | ==== Description 18 | 19 | A commit is simply a checkpoint telling Git to track all changes that have occurred up to the current point using the last commit as a comparison. 20 | 21 | A commit is carried out only if there are files in the staging area, so make sure to run link:#_git_add[`git add`] before this command. 22 | 23 | Every commit has a unique *SHA1* associated with it. 24 | 25 | Use link:#_git_log[`git log`] & link:#_git_show[`git show`] commands to get information on commits. 26 | 27 | IMPORTANT: Always link:#_git_pull[pull] before committing & pushing. 28 | 29 | TIP: Commit _related_ changes. 30 | 31 | TIP: Commit changes frequently. This makes it easier to revert back to older versions to correct mistakes. 32 | 33 | TIP: _Don't_ commit half-done or incomplete work. 34 | 35 | ===== Commit message/title 36 | 37 | * Every commit has a commit message associated with it which describes the overall change made. 38 | * Short, crisp and to-the-point commit messages are preferred (<50 characters). 39 | * Use the imperative, present tense (eg: 'change', not 'changed' or 'changes') in commit messages, to be consistent with generated messages from commands like `git merge`. 40 | ** Another way to think about commit messages is to write them such that the codebase is being instructed to do something. 41 | ** Eg: `git commit -m ":truck: feat: Implement Debouncing for search box"` 42 | * General commit message structure below 43 | 44 | [source, plaintext] 45 | ---- 46 | :sparkles: feat: add hat wobble (#26) 47 | ^--------^ ^---^ ^------------^ ^---^ 48 | | | | | 49 | | | | +----> PR or issue resolved (if any). 50 | | | | 51 | | | +----> Summary in present tense. 52 | | | 53 | | +----> Type:- chore, docs, feat, fix, refactor,style, test, etc. 54 | | 55 | +----> Emoji:- :tada: :bookmark: :sparkles: :bug: :books: :wrench: :truck: 56 | ---- 57 | 58 | IMPORTANT: More on https://gist.github.com/rishavpandey43/84665ffe3cea76400d8e5a1ad7133a79[types and emojis^]. 59 | 60 | ==== Options/Flags 61 | 62 | ===== No option 63 | 64 | * Just running `git commit` will launch a text editor prompting you for a commit message. 65 | * After you've entered a message, save the file and close the editor using `:wq` or just save and exit the editor to create the actual commit. 66 | 67 | ===== -m "" 68 | 69 | * Avoids opening a text editor by providing the commit message in the Command Prompt, Terminal, Powershell, etc... 70 | 71 | ===== -m "" -m "" 72 | 73 | * Enter the commit message and commit description if needed. 74 | 75 | ===== -a or --all 76 | 77 | * Automatically stages files that have been modified or deleted, but untracked files are not affected. 78 | * Eg: `git commit -a -m ""` or `git commit -am ""` 79 | 80 | ===== --amend 81 | 82 | * To change the commit message of the latest commit. 83 | * This will open a text editor to change the commit message. Once the file is saved and closed, the changes are made. 84 | * To do it directly from the command line use `git commit --amend -m "" -m ""`. (Commit description is optional.) 85 | 86 | NOTE: This command will change the commit message of the latest commit only. Refer to link:#_git_rebase[`git rebase`] for changing older commit messages. 87 | 88 | CAUTION: Any amend command re-writes the history of the repository as it entirely replaces the previous latest commit with the new one, so use this only for commits that are not link:#_git_push[pushed]. 89 | 90 | ===== --amend --no-edit 91 | 92 | * Allows amending a commit without having to change the commit message originally/already associated with that commit. 93 | * One usecase can be that if a user has forgotten to add a few files to the last commit, they can add the files using link:#_git_add[`git add`] and then amend the last commit with the `--no-edit` option. 94 | * Eg: `git commit --amend --no-edit` 95 | 96 | ===== --amend --author="Author Name " 97 | 98 | * Allows changing the author of the last commit. This does not change the committer of the previous commit. 99 | * Eg: `git commit --amend --author="Harsh Kapadia ` 100 | * If both, the author and the committer of the last commit need to be changed, edit the link:#_git_config[local or global Git config] and then amend the last commit using the `git commit --amend --no-edit` command. 101 | 102 | ===== --allow-empty 103 | 104 | * Allows creating a commit without making any changes. 105 | * One usecase can be to trigger a CI/CD workflow without making changes to the project. 106 | * Eg: `git commit --allow-empty -m ""`. 107 | 108 | ===== -m "Add only_this_file.ext from all staged files" only_this_file.ext 109 | 110 | * Partially committing staged changes 111 | 112 | ===== -s or --signoff 113 | 114 | * Adds `Signed-off-by: Author Name ` at the end of the commit message. 115 | * The meaning of a signoff depends on the project being contributed to. 116 | ** Eg: The Git and Linux Kernel projects use the signoff as a way to certify that the committer agrees with the link:https://developercertificate.org[Developer's Certificate of Origin^]. 117 | 118 | ===== -e or --edit 119 | 120 | * Forces opening the default Git/commit editor configured. 121 | 122 | ===== git ls-tree --full-tree -r HEAD 123 | 124 | * This command shows all files within your git repo that it is tracking. 125 | 126 | .Related 127 | **** 128 | * link:#_git_log[git log] 129 | * link:#_git_show[git show] 130 | * link:#_common_mistakes_how_to_correct_them[Amending a commit] 131 | **** 132 | 133 | ''' 134 | -------------------------------------------------------------------------------- /src/static/js/main.js: -------------------------------------------------------------------------------- 1 | const pwaInstallDiv = document.querySelector(".pwa-install-div"); 2 | const pwaInstallBtn = document.querySelector("#pwa-install-btn"); 3 | const pwaInstallDismiss = document.querySelector("#pwa-install-dismiss"); 4 | const backToTopBtn = document.querySelector(".back-to-top-btn"); 5 | const header = document.querySelector("#header"); 6 | const body = document.querySelector("body"); 7 | const toc = document.querySelector("#toc"); 8 | 9 | const dbName = "git_basics"; 10 | const dbVersion = 1; 11 | const objStoreName = "theme"; 12 | 13 | let pwaInstallEvent; 14 | let theme; 15 | let themeBtn; 16 | let systemDarkTheme = window.matchMedia("(prefers-color-scheme: dark)"); 17 | 18 | // Service worker and PWA 19 | 20 | if (navigator.serviceWorker) { 21 | window.addEventListener("load", () => { 22 | navigator.serviceWorker 23 | .register("service-worker.js") 24 | .catch((err) => console.error(`Service Worker error: ${err}`)); 25 | }); 26 | 27 | window.addEventListener("beforeinstallprompt", (e) => { 28 | e.preventDefault(); 29 | pwaInstallEvent = e; 30 | showPWAInstallPrompt(); 31 | }); 32 | 33 | pwaInstallBtn.addEventListener("click", () => { 34 | pwaInstallEvent.prompt(); 35 | pwaInstallDiv.classList.add("hidden"); 36 | }); 37 | 38 | pwaInstallDismiss.addEventListener("click", () => 39 | dismissPWAInstallPrompt() 40 | ); 41 | } 42 | 43 | // Window load listener 44 | 45 | window.addEventListener("load", async () => { 46 | await loadDatabase(); // Initially sets 'theme' variable. 47 | createThemeSwitcher(); 48 | applyTheme(); 49 | mobileEdgeCaseStyling(); 50 | addAnnouncement(); 51 | }); 52 | 53 | // System/browser theme change listener 54 | 55 | if (!systemDarkTheme.addEventListener) 56 | systemDarkTheme.addEventListener = (event, listener) => 57 | systemDarkTheme.addListener(listener); 58 | 59 | systemDarkTheme.addEventListener("change", async (e) => { 60 | if (e.matches) theme = "dark"; 61 | else theme = "light"; 62 | 63 | applyTheme(); 64 | }); 65 | 66 | // Back to top button 67 | 68 | const observer = new IntersectionObserver(scrollToTop); 69 | observer.observe(header); 70 | 71 | backToTopBtn.addEventListener("click", () => header.scrollIntoView(true)); 72 | 73 | // Functions 74 | 75 | function showPWAInstallPrompt() { 76 | pwaInstallDiv.classList.remove("hidden"); 77 | pwaInstallDiv.classList.add("pwa-install-div-summon"); 78 | } 79 | 80 | function dismissPWAInstallPrompt() { 81 | pwaInstallDiv.classList.add("pwa-install-div-dismiss"); 82 | setTimeout(() => pwaInstallDiv.classList.add("hidden"), 2000); 83 | } 84 | 85 | function scrollToTop(entries, observer) { 86 | entries.forEach((entry) => { 87 | if (entry.isIntersecting) backToTopBtn.classList.add("hidden"); 88 | else backToTopBtn.classList.remove("hidden"); 89 | }); 90 | } 91 | 92 | function createThemeSwitcher() { 93 | themeBtn = document.createElement("button"); 94 | 95 | themeBtn.classList.add("btn", "theme-switcher"); 96 | themeBtn.addEventListener("click", switchTheme); 97 | body.appendChild(themeBtn); 98 | } 99 | 100 | async function switchTheme() { 101 | if (theme === "light") { 102 | themeBtn.setAttribute("aria-label", "Light mode"); 103 | body.classList.add("dark"); 104 | theme = "dark"; 105 | await saveDatabase(); 106 | } else { 107 | themeBtn.setAttribute("aria-label", "Dark mode"); 108 | body.classList.remove("dark"); 109 | theme = "light"; 110 | await saveDatabase(); 111 | } 112 | } 113 | 114 | async function applyTheme() { 115 | if (theme === "light") { 116 | themeBtn.setAttribute("aria-label", "Dark mode"); 117 | body.classList.remove("dark"); 118 | await saveDatabase(); 119 | } else { 120 | themeBtn.setAttribute("aria-label", "Light mode"); 121 | body.classList.add("dark"); 122 | await saveDatabase(); 123 | } 124 | } 125 | 126 | async function loadDatabase() { 127 | return new Promise((resolve, reject) => { 128 | let request = indexedDB.open(dbName, dbVersion); 129 | 130 | request.addEventListener("error", reject); 131 | 132 | request.addEventListener("upgradeneeded", (e) => { 133 | let db = e.target.result; 134 | 135 | if (!db.objectStoreNames.contains(objStoreName)) 136 | db.createObjectStore(objStoreName); 137 | }); 138 | 139 | request.addEventListener("success", (e) => { 140 | let db = e.target.result; 141 | 142 | let transaction = db.transaction(objStoreName, "readonly"); 143 | let store = transaction.objectStore(objStoreName); 144 | 145 | let getTheme = store.get("theme"); 146 | getTheme.addEventListener("error", reject); 147 | getTheme.addEventListener("success", (e) => { 148 | let idbTheme = e.target.result; 149 | 150 | if (idbTheme) theme = idbTheme; 151 | else { 152 | if (systemDarkTheme.matches) theme = "dark"; 153 | else theme = "light"; 154 | } 155 | 156 | resolve(); 157 | }); 158 | }); 159 | }); 160 | } 161 | 162 | async function saveDatabase() { 163 | return new Promise((resolve, reject) => { 164 | let request = indexedDB.open(dbName, dbVersion); 165 | 166 | request.addEventListener("error", reject); 167 | 168 | request.addEventListener("success", (e) => { 169 | let db = e.target.result; 170 | 171 | let transaction = db.transaction(objStoreName, "readwrite"); 172 | let store = transaction.objectStore(objStoreName); 173 | 174 | store.put(theme, "theme"); 175 | resolve(); 176 | }); 177 | }); 178 | } 179 | 180 | function addAnnouncement() { 181 | const announcementWrapper = document.createElement("div"); 182 | const announcementText1 = document.createElement("span"); 183 | const announcementText2 = document.createElement("span"); 184 | const announcementText3 = document.createElement("span"); 185 | const googlePlayLink = document.createElement("a"); 186 | const asciidoctorJetLink = document.createElement("a"); 187 | 188 | announcementWrapper.classList.add("announcement"); 189 | 190 | announcementText1.innerText = "git_basics is available on the "; 191 | announcementText2.innerText = " and uses the "; 192 | announcementText3.innerText = " template! 🎉"; 193 | 194 | googlePlayLink.href = 195 | "https://play.google.com/store/apps/details?id=com.harsh_kapadia.git_basics"; 196 | googlePlayLink.target = "_blank"; 197 | googlePlayLink.rel = "noreferrer"; 198 | googlePlayLink.innerText = "Google Play Store"; 199 | 200 | asciidoctorJetLink.href = "https://harshkapadia2.github.io/asciidoctor-jet"; 201 | asciidoctorJetLink.target = "_blank"; 202 | asciidoctorJetLink.rel = "noreferrer"; 203 | asciidoctorJetLink.innerText = "Asciidoctor Jet"; 204 | asciidoctorJetLink.style.fontStyle = "italic"; 205 | 206 | announcementWrapper.appendChild(announcementText1); 207 | announcementWrapper.appendChild(googlePlayLink); 208 | announcementWrapper.appendChild(announcementText2); 209 | announcementWrapper.appendChild(asciidoctorJetLink); 210 | announcementWrapper.appendChild(announcementText3); 211 | header.insertBefore(announcementWrapper, toc); 212 | } 213 | 214 | function mobileEdgeCaseStyling() { 215 | const userAgent = navigator.userAgent; 216 | 217 | if ( 218 | (userAgent.indexOf("Edg") > -1 && userAgent.indexOf("Mobile") > -1) || 219 | userAgent.indexOf("iPhone") > -1 220 | ) 221 | body.classList.add("mobile-edge-case"); 222 | } 223 | -------------------------------------------------------------------------------- /src/content/misc/open_source_programs.adoc: -------------------------------------------------------------------------------- 1 | === Open Source Programs 2 | 3 | ==== Table of Contents 4 | 5 | * link:#_google_summer_of_code[Google Summer of Code] 6 | * link:#_google_season_of_docs[Google Season of Docs] 7 | * link:#_outreachy[Outreachy] 8 | * link:#_major_league_hacking_fellowship[Major League Hacking Fellowship] 9 | * link:#_linux_foundation_mentorship_program[Linux Foundation Mentorship Program] 10 | * link:#_summary[Summary] 11 | 12 | ==== Google Summer of Code 13 | 14 | image::gsoc.png[alt="GSoC Logo", 600, 300] 15 | 16 | Google Summer of Code (GSoC) is a global open source program where students can contribute to projects of organisations participating in Google Summer of Code for 10 weeks to gain exposure in the Software Development field and the participant will be paired with a mentor and get to learn various things in the domain of their interest. GSoC also provides a stipend to the participants. 17 | 18 | To participate in GSoC, it is recommended to contribute to an organisation of interest 2 to 3 months before the GSoC applications start. 19 | 20 | link:https://summerofcode.withgoogle.com[GSoC^] 21 | 22 | link:https://www.gsocorganizations.dev[GSoC Organisations^] 23 | 24 | ==== Google Season of Docs 25 | 26 | image::gsod.png[alt="GSoD Logo", 600, 300] 27 | 28 | Google Season of Docs (GSoD) provides support for open source projects to improve their documentation and gives professional technical writers an opportunity to gain experience in open source. 29 | 30 | link:https://developers.google.com/season-of-docs/docs/get-started[GSoD^] 31 | 32 | link:https://opensource.googleblog.com/2019/03/introducing-season-of-docs.html[Beginners Guide to GSoD^] 33 | 34 | ==== Outreachy 35 | 36 | image::outreachy.png[alt="Outreachy Logo", 600, 264] 37 | 38 | Outreachy is a three month long paid and remote internship for people who are underrepresented in specific fields. It is conducted twice a year. 39 | 40 | [IMPORTANT] 41 | ==== 42 | * Students who have participated in link:#_google_summer_of_code[Google Summer of Code] are not eligible for Outreachy. 43 | * Students whose university lies in the Northern Hemisphere are eligible to apply only for the first application round and those whose university lies in the Southern Hemisphere are eligible only for the second round. Those whose university lies near the Equator are eligible to apply in both the application rounds. 44 | ==== 45 | 46 | The application process of Outreachy 47 | 48 | * Initial Application Period 49 | ** For the initial application one needs to write five essays on the questions asked in the application. These essays are basically to understand whether one belongs to an underrepresented group or not. 50 | ** One is selected for the next step on the basis of these essays. 51 | * Contribution Period 52 | ** Now the list of projects will be released and participants need to contribute to their chosen projects and contact mentors. 53 | ** They also have to fill the final application. 54 | * Intern Selection Period 55 | ** Mentor will tell Outreachy organizers which intern they want and a final announcement for selected interns will be made. 56 | 57 | link:https://www.outreachy.org/apply[Outreachy^] 58 | 59 | link:https://hagerdakroury.github.io/post/outreachy-1[Beginners Guide to Outreachy^] 60 | 61 | ==== Major League Hacking Fellowship 62 | 63 | image::mlh.png[alt="MLH-logo", 600, 300] 64 | 65 | Major League Hacking (MLH) Fellowship is a 12 week internship program designed to level up Tech Skills. The Program is divided into three tracks 66 | 67 | * Open Source 68 | ** This track is about contributing to some great open source projects that are used by thousands of companies around the world. 69 | * Software Engineering 70 | ** This track is about working on real-world Software Engineering problems by collaborating on projects by real companies and Government partners. + 71 | * Prep Program 72 | ** THis track is about building out one's portfolio and experimenting with new technologies by collaborating in a short hackathon sprint. 73 | 74 | link:https://fellowship.mlh.io/programs/software-engineering[MLH Fellowship^] 75 | 76 | link:https://dev.to/pawankolhe/applying-to-the-mlh-fellowship-tips-tricks-1jc1[Beginners Guide to MLH Fellowship^] 77 | 78 | ==== Linux Foundation Mentorship Program 79 | 80 | image::the-linux-foundation.png[alt="Linux-foundation-logo", 600, 300] 81 | 82 | The Linux Foundation Mentorship Program gives one an opportunity to learn from open source contributors and contribute to open source projects. 83 | 84 | Current mentorship programs include 85 | 86 | * Linux Kernel 87 | * LF Networking 88 | * Hyperledger 89 | * CNCF 90 | * OpenHPC 91 | * Open Mainframe Project 92 | * GraphQL 93 | 94 | link:https://www.linuxfoundation.org/about/diversity-inclusivity/mentorship[Linux Foundation^] 95 | 96 | link:https://docs.linuxfoundation.org/lfx/mentorship[Beginners Guide to the Linux Foundation Mentorship Program^] 97 | 98 | [.x-overflow] 99 | ==== Summary 100 | 101 | [cols= "1, 2, 2, 3"] 102 | |=== 103 | | Name | Timeline | Links | Eligibility 104 | 105 | | Google Summer of Code (GSoC) 106 | | Oct-Aug 107 | | link:https://summerofcode.withgoogle.com[GSoC^] 108 | 109 | link:https://www.gsocorganizations.dev[GSoC Organisations^] 110 | | For Students: 111 | 112 | Age should be at least 18 years. 113 | 114 | Should be enrolled in a Post-Academic Program. 115 | 116 | Student must be eligible to work in the residing country for the duration of the program. 117 | 118 | Should should not be an Organisation Administrator or Mentor in the program. 119 | 120 | | Google Season Of Docs (GSoD) 121 | | Feb-Nov 122 | | link:https://developers.google.com/season-of-docs/docs/get-started[GSoD^] 123 | 124 | link:https://opensource.googleblog.com/2019/03/introducing-season-of-docs.html[Beginners Guide to GSoD^] 125 | | 126 | 127 | | Outreachy 128 | | May-Aug 129 | 130 | Dec-March 131 | | link:https://www.outreachy.org/apply[Outreachy^] 132 | 133 | link:https://hagerdakroury.github.io/post/outreachy-1[Beginners Guide to Outreachy^] 134 | | Students who have participated in link:#_google_summer_of_code[GSoC] are not eligible for Outreachy. 135 | 136 | Students whose university lies in the Northern Hemisphere are eligible to apply only for the first application round and those whose university lies in the Southern Hemisphere are eligible only for the second round. Those whose university lies near the Equator are eligible to apply in both the application rounds. 137 | 138 | | MLH Fellowship 139 | | Spring batch: Jan-April 140 | 141 | Summer batch: May-Aug 142 | 143 | Fall batch: Sept-Dec 144 | | link:https://fellowship.mlh.io/programs/software-engineering[MLH Fellowship^] 145 | 146 | link:https://dev.to/pawankolhe/applying-to-the-mlh-fellowship-tips-tricks-1jc1[Beginners guide to MLH Fellowship^] 147 | | Age should be above 18 yrs. 148 | 149 | Student should be able to spend the hours required by the program. 150 | 151 | | Linux Foundation Mentorship Program 152 | | Spring term: March-May 153 | 154 | Summer term: June-Aug 155 | 156 | Fall term: Sept-Nov 157 | | link:https://www.linuxfoundation.org/about/diversity-inclusivity/mentorship[Linux Foundation^] 158 | 159 | link:https://docs.linuxfoundation.org/lfx/mentorship[Beginners Guide to the Linux Foundation Mentorship Program^] 160 | | 161 | 162 | |=== 163 | 164 | ''' 165 | -------------------------------------------------------------------------------- /temp.md: -------------------------------------------------------------------------------- 1 | **_NOTE: The initial part of this repo is on the [hosted site](https://harshkapadia2.github.io/git_basics/). The parts below are in the process of being migrated to the hosted version._** 2 | 3 | This repo will always be a work in progress, so do make PRs to add your knowledge to it and correct any mistakes that might've been made! 4 | (TBC = To be continued) 5 | 6 | ## Common mistakes and how to correct them 7 | 8 | - TBC 9 | - Modificaions are made to files and the user wants to revert the files to the current commit state (The files are not staged) 10 | - [`git checkout HEAD .`](https://www.atlassian.com/git/tutorials/resetting-checking-out-and-reverting) 11 | - To revert all modified files to current commit state 12 | - `git checkout HEAD ` 13 | - To revert a particular modified file to current commit state 14 | - Temp resources 15 | - https://ohshitgit.com/ 16 | - https://www.youtube.com/watch?v=FdZecVxzJbk 17 | 18 | ## Conflict handling ([CLI Version](https://www.git-tower.com/learn/git/ebook/en/command-line/advanced-topics/merge-conflicts)) 19 | 20 | - Conflicts only affect the developer conducting the merge, the rest of the team is unaware of the conflict. Git will mark the file as being conflicted and halt the merging process. It is then the developers' responsibility to resolve the conflict. 21 | - Git can automatically merge commits unless there are changes that conflict in both commit sequences. 22 | - Eg: If in the [two branches that are trying to be merged](https://www.atlassian.com/git/tutorials/using-branches/git-merge), both have changes in the same part of the same file, Git won't be able to figure out which version to use. 23 | - [There are different types of merge conflicts.](https://www.atlassian.com/git/tutorials/using-branches/merge-conflicts) 24 | - Git fails to start the merge (due to unsaved local changes, so use `git stash`, `git commit`, `git reset`, `git checkout` etc to stabilize local.) 25 | - Git fails the ongoing merge (Git will do its best to merge the files but will leave things for the developer to resolve manually in the conflicted files.) 26 | - To represent the differences, visual markers used by are: `<<<<<<<`, `=======` and `>>>>>>>`. 27 | - Generally the content before the `=======` marker is the receiving branch and the part after is the merging branch. 28 | - Resolving a merge conflict 29 | - Use `git status` to identify the merge issues. 30 | - The most direct way to resolve a merge conflict is to edit the conflicted file. Open the file in a text editor and make the necessary changes to resolve the conflict. (Eg: Add the missing lines, delete the extra lines, etc...) 31 | - When the developer is ready to finish the merge, all they have to do is run `git add ` on the conflicted file(s) to tell Git that they're resolved. 32 | - Then, one has to run a normal `git commit -m ""` to generate the merge commit. 33 | - Git will see that the conflict has been resolved and creates a new merge commit to finalize the merge. 34 | - **Note:** Merge conflicts will only occur in the event of a 3-way merge. It’s not possible to have conflicting changes in a fast-forward merge. 35 | - Conflicts can occur for single files as well. They have to be handled in the same way as above. 36 | - `git diff` 37 | - `git diff` helps find differences between states of a repository/files. 38 | - This is useful in predicting and preventing merge conflicts. 39 | - This command shows the code differences between a file in the Staging Area and the edits made to that file that currently exist in the Working Tree. 40 | - Use `git diff ` to view the differences of just one file. 41 | - To see the changes in the Staging Area use `git diff --staged` 42 | - `git status` and `git diff` should be used frequently as they give information about the current working state and what git is aware of. They allow one to see what changes have occurred since their last checkpoint and are what one can use to guide themselves to atomic commits. 43 | 44 | ## Git CLIs vs GUIs 45 | 46 | - CLI pros 47 | - TBC 48 | - CLI cons 49 | 50 | - TBC 51 | 52 | - GUI pros 53 | - TBC 54 | - GUI cons 55 | 56 | - TBC 57 | 58 | - Temp resource 59 | - https://www.danclarke.com/git-gui-vs-cli 60 | 61 | ## GitHub basics 62 | 63 | - [Repos](https://www.sbf5.com/~cduan/technical/git/git-1.shtml) (Part 2) 64 | - In version control systems, repositories are accessed over a network which acts like a server and version control tool as a client. On establishing successful connection, clients store or retrieve their changes. 65 | - Private and public repos 66 | - [Licenses](https://choosealicense.com/) 67 | - README.md 68 | - TBC 69 | - md = [Markdown](https://www.youtube.com/watch?v=HUBNt18RFbo) 70 | - **GitHub is not git.** 71 | - Git is a revision control system, a tool to manage your source code history. 72 | - GitHub is a hosting service for Git repositories. 73 | - So they are not the same thing: Git is the tool, GitHub is the service for projects that use Git. 74 | - [Forking repos](https://www.toolsqa.com/git/git-fork/) 75 | - A fork is a copy of a repository. Forking a repository allows to freely experiment with changes without affecting the original project. 76 | - When a user forks a repository, all the files in the repository are automatically copied to the user’s account on GitHub and it feels like the user’s own repository. The user is then free to use this repository either for their purpose or experiment with changes in the code. Through git forking, the users can develop their own modifications to the code that belongs to someone else. 77 | - To make changes to the original project, make a PR. 78 | - PRs 79 | - A pull request is a method of submitting contributions to an open development project. 80 | - A pull request occurs when a developer asks for changes committed to an external repository to be considered for inclusion in a project’s main repository. 81 | - It is important to note that 'pull requests' are a workflow method, and are not a feature of the version control system itself. 82 | - [Issues](https://guides.github.com/features/issues/) 83 | - Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. 84 | - Most software projects have a bug tracker of some kind. GitHub’s tracker is called Issues, and has its own section in every repository. 85 | - Anyone can raise issues. 86 | - Starring repos 87 | - Save a repo for future reference. 88 | - Conflict Handling ([GUI Version](https://www.git-tower.com/learn/git/ebook/en/desktop-gui/advanced-topics/merge-conflicts)) 89 | - xyz 90 | - GitHub Desktop 91 | - GUI (like Atlassian BitBucket, SourceTree, etc.) 92 | - Used for collaboration among developers and during competitions like hackathons. 93 | - [GitHub Student Developer's Pack](https://education.github.com/pack) 94 | - Free and gives TONS for features. 95 | - Upload valid college ID and e-mail (personal e-mail if you don't have a college-provided e-mail ID) 96 | - Will have to be renewed. 97 | 98 | ## Open Source 99 | 100 | - OSS - Open Source Software 101 | - [Why and how to contribute to Open Source](https://rubygarage.org/blog/how-contribute-to-open-source-projects) 102 | - [GSoC](https://summerofcode.withgoogle.com/) & [GSSoC](https://www.gssoc.tech/) 103 | - [Hacktoberfest](https://hacktoberfest.digitalocean.com/) 104 | 105 | ## Communities & meetups 106 | 107 | - [Reasons why you should attend tech meetups](https://interpropeople.com/7-reasons-go-tech-meetups/) 108 | - [Meetup app](https://www.meetup.com/apps/) 109 | 110 | ## Misc 111 | 112 | ### Misc resources & articles for Git 113 | 114 | NOTE: This section has been moved to the hosted version at https://harshkapadia2.github.io/git_basics/#_resources 115 | 116 | # BYE BYE! ( : 117 | 118 | **Star this repo if you liked it and don't forget to share it with your friends/coworkers!** 119 | 120 | ![](https://miro.medium.com/max/1238/1*_UUaozFPd2qHfCFjlhIgGA.png) 121 | -------------------------------------------------------------------------------- /src/static/css/style.css: -------------------------------------------------------------------------------- 1 | a { 2 | color: #2156a5; 3 | text-decoration-thickness: 1px; 4 | text-underline-offset: 4px; 5 | } 6 | 7 | a code { 8 | color: #2156a5; 9 | } 10 | 11 | a:hover, 12 | a:hover code, 13 | a code:hover { 14 | color: #1d4b8f !important; 15 | } 16 | 17 | #footer a { 18 | color: #90caf9 !important; 19 | } 20 | 21 | #footer a:hover { 22 | color: #42a5f5 !important; 23 | } 24 | 25 | .imageblock { 26 | display: flex; 27 | flex-direction: column; 28 | align-items: center; 29 | } 30 | 31 | .icon img { 32 | width: 40px; 33 | height: 40px; 34 | } 35 | 36 | pre, 37 | code { 38 | background-color: #eeeeee !important; 39 | } 40 | 41 | h1, 42 | .title { 43 | color: #ba3925 !important; 44 | } 45 | 46 | .announcement { 47 | font-weight: bold; 48 | font-size: 1.5em; 49 | line-height: 1.5em; 50 | margin-top: 1em; 51 | margin-bottom: 0.5em; 52 | min-height: 5em; 53 | } 54 | 55 | .announcement img { 56 | width: 9em; 57 | } 58 | 59 | .pwa-install-div { 60 | position: fixed; 61 | bottom: 2.5vh; 62 | left: 2vw; 63 | display: flex; 64 | align-items: center; 65 | background-color: white; 66 | padding: 0.5em; 67 | box-shadow: 0 0 3px #bdbdbd; 68 | border-radius: 5px; 69 | z-index: 1000; 70 | } 71 | 72 | #pwa-install-btn { 73 | color: white; 74 | background-color: black; 75 | padding: 0.3em 0.6em; 76 | margin-right: 0.5em; 77 | font-size: 15px; 78 | border-radius: 5px; 79 | border: 1px solid black; 80 | box-shadow: 0 0 3px #bdbdbd; 81 | cursor: pointer; 82 | } 83 | 84 | #pwa-install-btn { 85 | margin: 0 0.8em 0 0.5em; 86 | } 87 | 88 | #pwa-install-dismiss { 89 | background-color: transparent; 90 | border: none; 91 | display: grid; 92 | place-items: center; 93 | cursor: pointer; 94 | } 95 | 96 | #pwa-install-dismiss img { 97 | height: 1.5em; 98 | width: 1.5em; 99 | } 100 | 101 | .pwa-install-div-summon { 102 | animation: 3s ease summon-div; 103 | } 104 | 105 | @keyframes summon-div { 106 | from { 107 | transform: translateX(-100vw); 108 | } 109 | 110 | to { 111 | transform: translateX(0); 112 | } 113 | } 114 | 115 | .pwa-install-div-dismiss { 116 | animation: 2s ease dismiss-div; 117 | } 118 | 119 | @keyframes dismiss-div { 120 | from { 121 | transform: translateX(0); 122 | } 123 | 124 | to { 125 | transform: translateX(-100vw); 126 | } 127 | } 128 | 129 | .btn { 130 | display: grid; 131 | place-items: center; 132 | background-color: white; 133 | border-radius: 2em; 134 | border: 1px solid white; 135 | box-shadow: 0 0 5px #bdbdbd; 136 | cursor: pointer; 137 | z-index: 1000; 138 | outline: none; 139 | } 140 | 141 | .btn:focus { 142 | box-shadow: 0 0 5px #757575; 143 | } 144 | 145 | .btn img { 146 | height: 1em; 147 | width: 1em; 148 | } 149 | 150 | .back-to-top-btn { 151 | padding: 1em; 152 | position: fixed; 153 | bottom: 2.5vh; 154 | right: 2vw; 155 | } 156 | 157 | .theme-switcher { 158 | padding: 1.5em; 159 | position: absolute; 160 | top: 2.5vh; 161 | right: 2vw; 162 | background: url("../img/moon.svg") no-repeat center; 163 | } 164 | 165 | .hidden { 166 | display: none; 167 | } 168 | 169 | #footer { 170 | background-color: black; 171 | color: #e0e0e0; 172 | display: flex; 173 | justify-content: center; 174 | align-items: center; 175 | } 176 | 177 | @media screen and (max-width: 600px) { 178 | .announcement { 179 | min-height: 6em; 180 | } 181 | 182 | .announcement img { 183 | width: 7em; 184 | } 185 | } 186 | 187 | /* ================================================== MOBILE EDGE CASES ==================================================== */ 188 | 189 | body.mobile-edge-case .word-break-all { 190 | word-break: break-all; 191 | } 192 | 193 | .x-overflow { 194 | overflow-x: auto; 195 | } 196 | 197 | /* ================================================== TOC (LIGHT MODE) ============================================== */ 198 | 199 | #toctitle, 200 | .sectlevel1 li a { 201 | color: #ba3925 !important; 202 | } 203 | 204 | .sectlevel1 li a:hover { 205 | color: #ba3925 !important; 206 | text-decoration: underline !important; 207 | } 208 | 209 | .sectlevel2 li a { 210 | color: #2156a5 !important; 211 | } 212 | 213 | .sectlevel2 li a:hover { 214 | color: #1d4b8f !important; 215 | text-decoration: underline !important; 216 | } 217 | 218 | /* ================================================= SCROLLBAR (LIGHT MODE) =================================================== */ 219 | 220 | body::-webkit-scrollbar { 221 | width: 0.7em; 222 | } 223 | 224 | #toc::-webkit-scrollbar { 225 | width: 0.5em; 226 | } 227 | 228 | body::-webkit-scrollbar-track, 229 | #toc::-webkit-scrollbar-track { 230 | background-color: #eeeeee; 231 | } 232 | 233 | body::-webkit-scrollbar-thumb, 234 | #toc::-webkit-scrollbar-thumb { 235 | background-color: #bdbdbd; 236 | border-radius: 2px; 237 | } 238 | 239 | /* ======================================================= DARK MODE =========================================================== */ 240 | 241 | body.dark, 242 | body.dark .btn, 243 | body.dark table, 244 | body.dark th { 245 | background-color: black; 246 | color: #e0e0e0; 247 | } 248 | 249 | body.dark .btn { 250 | box-shadow: 0 0 5px #616161; 251 | border: 1px solid black; 252 | } 253 | 254 | body.dark .btn:focus { 255 | box-shadow: 0 0 5px #9e9e9e; 256 | } 257 | 258 | body.dark .theme-switcher { 259 | background: url("../img/sun.svg") no-repeat center; 260 | } 261 | 262 | body.dark h1, 263 | body.dark h2, 264 | body.dark h3, 265 | body.dark h4, 266 | body.dark h5, 267 | body.dark h6, 268 | body.dark #toctitle, 269 | body.dark .sidebarblock .title, 270 | body.dark .imageblock .title { 271 | color: #ff8a80 !important; 272 | } 273 | 274 | body.dark blockquote::before { 275 | color: #d32f2f !important; 276 | } 277 | 278 | body.dark code, 279 | body.dark pre { 280 | background-color: #424242 !important; 281 | color: #e0e0e0; 282 | } 283 | 284 | body.dark .sectlevel1 li a { 285 | color: #ff8a80 !important; 286 | } 287 | 288 | body.dark a, 289 | body.dark a code, 290 | body.dark .sectlevel2 li a { 291 | color: #90caf9 !important; 292 | } 293 | 294 | body.dark a:hover, 295 | body.dark a:hover code, 296 | body.dark a code:hover, 297 | body.dark .sectlevel2 li a:hover { 298 | color: #42a5f5 !important; 299 | } 300 | 301 | body.dark #toc, 302 | body.dark .pwa-install-div { 303 | background-color: black !important; 304 | } 305 | 306 | body.dark #toc { 307 | border-left-color: #212121; 308 | border-right-color: #212121; 309 | } 310 | 311 | body.dark .pwa-install-div { 312 | box-shadow: 0 0 5px #424242; 313 | } 314 | 315 | body.dark #pwa-install-btn { 316 | box-shadow: 0 0 5px #424242; 317 | background-color: #e0e0e0; 318 | border: 1px solid #e0e0e0; 319 | color: black; 320 | } 321 | 322 | body.dark li, 323 | body.dark p, 324 | body.dark .details, 325 | body.dark td, 326 | body.dark blockquote, 327 | body.dark .attribution cite { 328 | color: #e0e0e0 !important; 329 | } 330 | 331 | body.dark .sidebarblock { 332 | background-color: #212121 !important; 333 | } 334 | 335 | body.dark::-webkit-scrollbar-track, 336 | body.dark #toc::-webkit-scrollbar-track { 337 | background-color: #212121; 338 | } 339 | 340 | body.dark::-webkit-scrollbar-thumb, 341 | body.dark #toc::-webkit-scrollbar-thumb { 342 | background-color: #616161; 343 | } 344 | 345 | /* ================================================ FONTS ================================================== */ 346 | 347 | body, 348 | .admonitionblock td.content > .title, 349 | .audioblock > .title, 350 | .exampleblock > .title, 351 | .imageblock > .title, 352 | .listingblock > .title, 353 | .literalblock > .title, 354 | .stemblock > .title, 355 | .openblock > .title, 356 | .paragraph > .title, 357 | .quoteblock > .title, 358 | table.tableblock > .title, 359 | .verseblock > .title, 360 | .videoblock > .title, 361 | .dlist > .title, 362 | .olist > .title, 363 | .ulist > .title, 364 | .qlist > .title, 365 | .hdlist > .title, 366 | h1, 367 | h2, 368 | h3, 369 | #toctitle, 370 | .sidebarblock > .content > .title, 371 | h4, 372 | h5, 373 | h6, 374 | #toc ul, 375 | .admonitionblock > table td.icon .title, 376 | .verseblock pre, 377 | .conum[data-value] { 378 | font-family: "Montserrat", sans-serif; 379 | } 380 | 381 | code, 382 | kbd, 383 | pre, 384 | samp { 385 | font-family: "PT Mono", monospace; 386 | } 387 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to git_basics 2 | 3 | - Please be mindful of the [Code of Conduct](CODE_OF_CONDUCT.md) while interacting or contributing! 4 | - First time contributors can solve [`good first issues`](https://github.com/HarshKapadia2/git_basics/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22). 5 | - Any contributor with some Git and GitHub knowledge can consider adding some of the requirements listed in the [issues](https://github.com/HarshKapadia2/git_basics/issues). 6 | - If any contributor wants to tackle an issue or a part of it, please leave a comment on the issue (mentioning the part they want to tackle), so that they can be assigned to that part of the issue and multiple people do not handle the same part of the issue. 7 | 8 | ## Tech Stack 9 | 10 | - Front end: [Asciidoctor Jet](https://harshkapadia2.github.io/asciidoctor-jet) 11 | - CI/CD: GitHub Actions 12 | 13 | > NOTE: 14 | > 15 | > - This project uses a Static Site Generator called [Asciidoctor](https://asciidoctor.org). 16 | > - This project is a [PWA](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps) and a [TWA](https://developer.chrome.com/docs/android/trusted-web-activity). ([Asset links file](https://github.com/HarshKapadia2/harshkapadia2.github.io/blob/main/.well-known/assetlinks.json)) 17 | > - GitHub Actions has been set up on this repo, so a built web site does not have to be committed. 18 | 19 | ## Gitpod Setup 20 | 21 | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/HarshKapadia2/git_basics) 22 | 23 | - On clicking on the above 'Open in Gitpod' button, a Gitpod Workspace with [Asciidoctor](https://asciidoctor.org) and other dependencies installed will open up. 24 | - A [GitHub integration](https://gitpod.io/integrations) will be required on Gitpod if not already done. Also, make sure to give appropriate permissions to GitHub on the [Integrations page](https://gitpod.io/integrations). 25 | - **Please adhere to the [file structure](#file-structure) and [language, code and syntax rules](#language-code-and-syntax) followed in this project.** 26 | - [Make a new Git branch](https://harshkapadia2.github.io/git_basics/#_branch_name_2) on Gitpod and [switch to the newly created branch](https://harshkapadia2.github.io/git_basics/#_git_switch). 27 | - For testing, generate the web site in a directory called `build` in the root directory by running the command `sh build.sh` from the root directory. 28 | - To host the site locally from the `build` directory, run the command `serve build` from the root directory. 29 | - One can also use the Live Server VS Code extension that should have been automatically been installed. 30 | - Click on the 'Go Live' button in the Status Bar at the bottom of the window. 31 | - Please **do not** commit this `build` directory, as the CI process will build the site on merge. 32 | - A browser window with the web app should automatically open up, but if it doesn't, ctrl + click the link in the terminal to open up a window. 33 | - NOTE: The summary will have to be built manually using the `sh build.sh` command every time there is a change. The browser will then have to be refreshed to view the change. 34 | - Make the required contribution(s) on Gitpod in the new branch. 35 | - Please follow the [commit message format](https://harshkapadia2.github.io/git_basics/#_commit_messagetitle). 36 | - To open a PR 37 | - Fork this repo. (Top right corner on GitHub.) 38 | - On Gitpod, [add the forked repo as a remote](https://harshkapadia2.github.io/git_basics/#_add_connecting_repo_alias_connecting_repo_url_git). 39 | - [Push the new branch to the forked repo.](https://harshkapadia2.github.io/git_basics/#_command_16) 40 | - [Open a PR as usual](https://github.com/firstcontributions/first-contributions#submit-your-changes-for-review) from the forked repo on GitHub. 41 | 42 | ## Local Setup 43 | 44 | - Fork this repo. (Top right corner.) 45 | - Clone the forked repo using the [`git clone`](https://harshkapadia2.github.io/git_basics/#_git_clone) command. 46 | - [Install Asciidoctor](https://asciidoctor.org/#installation). 47 | - **Please adhere to the [file structure](#file-structure) and [language, code and syntax rules](#language-code-and-syntax) followed in this project.** 48 | - Testing 49 | - Generate the web site in a directory called `build` in the root directory by running the command `sh build.sh` from the root directory. 50 | - It is preferable to use a package like [http-server](https://www.npmjs.com/package/http-server) (`npx http-server "build"`) or [serve](https://www.npmjs.com/package/serve) (`npx serve "build"`) to host the site locally from the `build` directory. 51 | - Please **do not** commit this `build` directory, as the CI process will build the site on merge. 52 | - Make contribution(s) 53 | 54 | - Write meaningful commit messages and include the number (`#`) of the issue being resolved (if any) at the end of the commit message. 55 | 56 | Example: `:bug: fix: Resolve 'isCorrect' function error (#0)` 57 | 58 | [Commit message format](https://harshkapadia2.github.io/git_basics/#_commit_messagetitle) 59 | 60 | - Open a Pull Request (PR). 61 | - [Learn how to open a PR](https://github.com/firstcontributions/first-contributions). 62 | - Solve one issue per PR, **without any extra changes**. 63 | - **Include extra changes in a separate PR.** 64 | 65 | ## File Structure 66 | 67 | ### Parsing 68 | 69 | Asciidoctor parses files starting from `index.adoc` and follows `include::` to the **relative location** of the next file, to finally get to the file with the content. 70 | 71 | **Example**: 72 | 73 | This is how the content of [`git_add.adoc`](https://github.com/HarshKapadia2/git_basics/blob/main/src/content/commands/git_add.adoc) is displayed: 74 | 75 | > Check the raw file contents for the exact syntax. 76 | 77 | - In [`index.adoc`](https://github.com/HarshKapadia2/git_basics/blob/main/src/index.adoc#commands): 78 | 79 | ```asciidoc 80 | == Commands 81 | include::./refs/commands.adoc[] 82 | ``` 83 | 84 | 👇 85 | 86 | - In [`./refs/commands.adoc`](https://github.com/HarshKapadia2/git_basics/blob/main/src/refs/commands.adoc#:~:text=../content/commands/git_add.adoc): 87 | 88 | ```asciidoc 89 | include::../content/commands/git_add.adoc[] 90 | ``` 91 | 92 | 👇 93 | 94 | - In [`../content/commands/git_add.adoc`](https://github.com/HarshKapadia2/git_basics/blob/main/src/content/commands/git_add.adoc): 95 | 96 | ```asciidoc 97 | === git add 98 | 99 | // Actual content that is displayed 100 | ``` 101 | 102 | ### Static Files 103 | 104 | - CSS, JS and images are located in the `./src/static` directory. Add the appropriate static files to the appropriate static directory. 105 | 106 | #### Caching 107 | 108 | - If any static file is added, please make sure to 109 | - Include it in the `cacheAssets` array in `./src/service_worker.js` as a relative path. 110 | - Increment the value of the `cacheName` variable. (Example: From `v2` to `v3`.) 111 | - Add it to `./src/docinfo.html` with the correct syntax if the static file needs to be linked to the final site. 112 | - If any static file is modified, please make sure to 113 | - Increment the value of the `cacheName` variable. (Example: From `v2` to `v3`.) 114 | - If any static file is deleted, please make sure to 115 | - Remove it from the `cacheAssets` array in `./src/service_worker.js`. 116 | - Increment the value of the `cacheName` variable. (Example: From `v2` to `v3`.) 117 | - Remove it from `./src/docinfo.html` if present. 118 | - If any static file is renamed, please make sure to 119 | - Rename it in the `cacheAssets` array in `./src/service_worker.js`. 120 | - Increment the value of the `cacheName` variable. (Example: From `v2` to `v3`.) 121 | - Rename it in `./src/docinfo.html` if present. 122 | - **The `cacheName` should be updated just once per commit.** 123 | 124 | #### Images 125 | 126 | Images should have 127 | 128 | - A solid colour background. (No transparent images.) 129 | - A width and height of 600px, unless that distorts the picture or makes it illegible, in which case suitable dimensions can be used. 130 | - An `alt` attribute describing the image in a few words. 131 | 132 | Example: 133 | 134 | ``` 135 | image::file_name.ext[alt="image description", 600, 600, ...] 136 | ``` 137 | 138 | ## Language, Code and Syntax 139 | 140 | - Pronouns are either omitted (preferred) or third person pronouns ('they', 'their', 'one', etc.) are used. 141 | 142 | **Example**: 143 | 144 | - `Code should be committed frequently.` ✔️ (Preferred) 145 | - `One should commit code frequently.` ✔️ (Accepted) 146 | - `You should commit code frequently.` ❌ (Not accepted) 147 | 148 | - [Prettier](https://prettier.io) should be used to format code. 149 | 150 | - The [`.prettierrc`](.prettierrc) config file can be found in the root directory. 151 | - Please use the Prettier's [VS Code extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) or [CLI](https://prettier.io/docs/en/cli.html) to format code before committing. 152 | 153 | - The [AsciiDoc](https://marketplace.visualstudio.com/items?itemName=asciidoctor.asciidoctor-vscode) extension can be used, for syntax highlighting in `.adoc` files in VS Code. 154 | 155 | - [Asciidoctor syntax](https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference) (Quick reference.) 156 | - Use the same syntax as used in the other files to maintain uniformity. Avoid using variations in syntax. 157 | - Writing in bullet points is preferable. 158 | - Bold, underline and italics should be used sparingly. 159 | - Surround single line commands or file names with a single 'back tick' (`). 160 | - Surround code snippets with three 'back ticks' (`\``). 161 | - External links should include a caret (`^`) at the end of the link text to open them in a new tab. 162 | 163 | **Example**: 164 | 165 | - `link:https://github.com[This is a link to another site^]` (Caret at the end for external links.) 166 | - `link:#_issues[This is a link to the same site]` (No caret at the end for internal links.) 167 | 168 | - If external links are pasted as normal links, do following to open it in a new tab 169 | 170 | **Example**: `link:https://github.com/HarshKapadia2/git_basics[github.com/HarshKapadia2/git_basics^]` 171 | 172 | - Links should have meaningful text. 173 | 174 | **Example**: 175 | 176 | - `It can be found in the link:https://docs.github.com[official documentation^].` ✔️ (Accepted) 177 | - `It can be found link:https://docs.github.com[here^].` ❌ (Not accepted) 178 | 179 | ## Further Help 180 | 181 | If any further help is needed, do not hesitate to contact the owner ([Harsh Kapadia](https://harshkapadia.me)) via [OTC](https://ourtech.community), [Twitter](https://twitter.com/harshgkapadia), [LinkedIn](https://www.linkedin.com/in/harshgkapadia) or e-mail ([contact@harshkapadia.me](mailto:contact@harshkapadia.me)). An [issue](https://github.com/HarshKapadia2/git_basics/issues) can be raised as well. 182 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Attribution-ShareAlike 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution-ShareAlike 4.0 International Public 58 | License 59 | 60 | By exercising the Licensed Rights (defined below), You accept and agree 61 | to be bound by the terms and conditions of this Creative Commons 62 | Attribution-ShareAlike 4.0 International Public License ("Public 63 | License"). To the extent this Public License may be interpreted as a 64 | contract, You are granted the Licensed Rights in consideration of Your 65 | acceptance of these terms and conditions, and the Licensor grants You 66 | such rights in consideration of benefits the Licensor receives from 67 | making the Licensed Material available under these terms and 68 | conditions. 69 | 70 | 71 | Section 1 -- Definitions. 72 | 73 | a. Adapted Material means material subject to Copyright and Similar 74 | Rights that is derived from or based upon the Licensed Material 75 | and in which the Licensed Material is translated, altered, 76 | arranged, transformed, or otherwise modified in a manner requiring 77 | permission under the Copyright and Similar Rights held by the 78 | Licensor. For purposes of this Public License, where the Licensed 79 | Material is a musical work, performance, or sound recording, 80 | Adapted Material is always produced where the Licensed Material is 81 | synched in timed relation with a moving image. 82 | 83 | b. Adapter's License means the license You apply to Your Copyright 84 | and Similar Rights in Your contributions to Adapted Material in 85 | accordance with the terms and conditions of this Public License. 86 | 87 | c. BY-SA Compatible License means a license listed at 88 | creativecommons.org/compatiblelicenses, approved by Creative 89 | Commons as essentially the equivalent of this Public License. 90 | 91 | d. Copyright and Similar Rights means copyright and/or similar rights 92 | closely related to copyright including, without limitation, 93 | performance, broadcast, sound recording, and Sui Generis Database 94 | Rights, without regard to how the rights are labeled or 95 | categorized. For purposes of this Public License, the rights 96 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 97 | Rights. 98 | 99 | e. Effective Technological Measures means those measures that, in the 100 | absence of proper authority, may not be circumvented under laws 101 | fulfilling obligations under Article 11 of the WIPO Copyright 102 | Treaty adopted on December 20, 1996, and/or similar international 103 | agreements. 104 | 105 | f. Exceptions and Limitations means fair use, fair dealing, and/or 106 | any other exception or limitation to Copyright and Similar Rights 107 | that applies to Your use of the Licensed Material. 108 | 109 | g. License Elements means the license attributes listed in the name 110 | of a Creative Commons Public License. The License Elements of this 111 | Public License are Attribution and ShareAlike. 112 | 113 | h. Licensed Material means the artistic or literary work, database, 114 | or other material to which the Licensor applied this Public 115 | License. 116 | 117 | i. Licensed Rights means the rights granted to You subject to the 118 | terms and conditions of this Public License, which are limited to 119 | all Copyright and Similar Rights that apply to Your use of the 120 | Licensed Material and that the Licensor has authority to license. 121 | 122 | j. Licensor means the individual(s) or entity(ies) granting rights 123 | under this Public License. 124 | 125 | k. Share means to provide material to the public by any means or 126 | process that requires permission under the Licensed Rights, such 127 | as reproduction, public display, public performance, distribution, 128 | dissemination, communication, or importation, and to make material 129 | available to the public including in ways that members of the 130 | public may access the material from a place and at a time 131 | individually chosen by them. 132 | 133 | l. Sui Generis Database Rights means rights other than copyright 134 | resulting from Directive 96/9/EC of the European Parliament and of 135 | the Council of 11 March 1996 on the legal protection of databases, 136 | as amended and/or succeeded, as well as other essentially 137 | equivalent rights anywhere in the world. 138 | 139 | m. You means the individual or entity exercising the Licensed Rights 140 | under this Public License. Your has a corresponding meaning. 141 | 142 | 143 | Section 2 -- Scope. 144 | 145 | a. License grant. 146 | 147 | 1. Subject to the terms and conditions of this Public License, 148 | the Licensor hereby grants You a worldwide, royalty-free, 149 | non-sublicensable, non-exclusive, irrevocable license to 150 | exercise the Licensed Rights in the Licensed Material to: 151 | 152 | a. reproduce and Share the Licensed Material, in whole or 153 | in part; and 154 | 155 | b. produce, reproduce, and Share Adapted Material. 156 | 157 | 2. Exceptions and Limitations. For the avoidance of doubt, where 158 | Exceptions and Limitations apply to Your use, this Public 159 | License does not apply, and You do not need to comply with 160 | its terms and conditions. 161 | 162 | 3. Term. The term of this Public License is specified in Section 163 | 6(a). 164 | 165 | 4. Media and formats; technical modifications allowed. The 166 | Licensor authorizes You to exercise the Licensed Rights in 167 | all media and formats whether now known or hereafter created, 168 | and to make technical modifications necessary to do so. The 169 | Licensor waives and/or agrees not to assert any right or 170 | authority to forbid You from making technical modifications 171 | necessary to exercise the Licensed Rights, including 172 | technical modifications necessary to circumvent Effective 173 | Technological Measures. For purposes of this Public License, 174 | simply making modifications authorized by this Section 2(a) 175 | (4) never produces Adapted Material. 176 | 177 | 5. Downstream recipients. 178 | 179 | a. Offer from the Licensor -- Licensed Material. Every 180 | recipient of the Licensed Material automatically 181 | receives an offer from the Licensor to exercise the 182 | Licensed Rights under the terms and conditions of this 183 | Public License. 184 | 185 | b. Additional offer from the Licensor -- Adapted Material. 186 | Every recipient of Adapted Material from You 187 | automatically receives an offer from the Licensor to 188 | exercise the Licensed Rights in the Adapted Material 189 | under the conditions of the Adapter's License You apply. 190 | 191 | c. No downstream restrictions. You may not offer or impose 192 | any additional or different terms or conditions on, or 193 | apply any Effective Technological Measures to, the 194 | Licensed Material if doing so restricts exercise of the 195 | Licensed Rights by any recipient of the Licensed 196 | Material. 197 | 198 | 6. No endorsement. Nothing in this Public License constitutes or 199 | may be construed as permission to assert or imply that You 200 | are, or that Your use of the Licensed Material is, connected 201 | with, or sponsored, endorsed, or granted official status by, 202 | the Licensor or others designated to receive attribution as 203 | provided in Section 3(a)(1)(A)(i). 204 | 205 | b. Other rights. 206 | 207 | 1. Moral rights, such as the right of integrity, are not 208 | licensed under this Public License, nor are publicity, 209 | privacy, and/or other similar personality rights; however, to 210 | the extent possible, the Licensor waives and/or agrees not to 211 | assert any such rights held by the Licensor to the limited 212 | extent necessary to allow You to exercise the Licensed 213 | Rights, but not otherwise. 214 | 215 | 2. Patent and trademark rights are not licensed under this 216 | Public License. 217 | 218 | 3. To the extent possible, the Licensor waives any right to 219 | collect royalties from You for the exercise of the Licensed 220 | Rights, whether directly or through a collecting society 221 | under any voluntary or waivable statutory or compulsory 222 | licensing scheme. In all other cases the Licensor expressly 223 | reserves any right to collect such royalties. 224 | 225 | 226 | Section 3 -- License Conditions. 227 | 228 | Your exercise of the Licensed Rights is expressly made subject to the 229 | following conditions. 230 | 231 | a. Attribution. 232 | 233 | 1. If You Share the Licensed Material (including in modified 234 | form), You must: 235 | 236 | a. retain the following if it is supplied by the Licensor 237 | with the Licensed Material: 238 | 239 | i. identification of the creator(s) of the Licensed 240 | Material and any others designated to receive 241 | attribution, in any reasonable manner requested by 242 | the Licensor (including by pseudonym if 243 | designated); 244 | 245 | ii. a copyright notice; 246 | 247 | iii. a notice that refers to this Public License; 248 | 249 | iv. a notice that refers to the disclaimer of 250 | warranties; 251 | 252 | v. a URI or hyperlink to the Licensed Material to the 253 | extent reasonably practicable; 254 | 255 | b. indicate if You modified the Licensed Material and 256 | retain an indication of any previous modifications; and 257 | 258 | c. indicate the Licensed Material is licensed under this 259 | Public License, and include the text of, or the URI or 260 | hyperlink to, this Public License. 261 | 262 | 2. You may satisfy the conditions in Section 3(a)(1) in any 263 | reasonable manner based on the medium, means, and context in 264 | which You Share the Licensed Material. For example, it may be 265 | reasonable to satisfy the conditions by providing a URI or 266 | hyperlink to a resource that includes the required 267 | information. 268 | 269 | 3. If requested by the Licensor, You must remove any of the 270 | information required by Section 3(a)(1)(A) to the extent 271 | reasonably practicable. 272 | 273 | b. ShareAlike. 274 | 275 | In addition to the conditions in Section 3(a), if You Share 276 | Adapted Material You produce, the following conditions also apply. 277 | 278 | 1. The Adapter's License You apply must be a Creative Commons 279 | license with the same License Elements, this version or 280 | later, or a BY-SA Compatible License. 281 | 282 | 2. You must include the text of, or the URI or hyperlink to, the 283 | Adapter's License You apply. You may satisfy this condition 284 | in any reasonable manner based on the medium, means, and 285 | context in which You Share Adapted Material. 286 | 287 | 3. You may not offer or impose any additional or different terms 288 | or conditions on, or apply any Effective Technological 289 | Measures to, Adapted Material that restrict exercise of the 290 | rights granted under the Adapter's License You apply. 291 | 292 | 293 | Section 4 -- Sui Generis Database Rights. 294 | 295 | Where the Licensed Rights include Sui Generis Database Rights that 296 | apply to Your use of the Licensed Material: 297 | 298 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 299 | to extract, reuse, reproduce, and Share all or a substantial 300 | portion of the contents of the database; 301 | 302 | b. if You include all or a substantial portion of the database 303 | contents in a database in which You have Sui Generis Database 304 | Rights, then the database in which You have Sui Generis Database 305 | Rights (but not its individual contents) is Adapted Material, 306 | 307 | including for purposes of Section 3(b); and 308 | c. You must comply with the conditions in Section 3(a) if You Share 309 | all or a substantial portion of the contents of the database. 310 | 311 | For the avoidance of doubt, this Section 4 supplements and does not 312 | replace Your obligations under this Public License where the Licensed 313 | Rights include other Copyright and Similar Rights. 314 | 315 | 316 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 317 | 318 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 319 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 320 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 321 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 322 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 323 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 324 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 325 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 326 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 327 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 328 | 329 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 330 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 331 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 332 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 333 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 334 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 335 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 336 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 337 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 338 | 339 | c. The disclaimer of warranties and limitation of liability provided 340 | above shall be interpreted in a manner that, to the extent 341 | possible, most closely approximates an absolute disclaimer and 342 | waiver of all liability. 343 | 344 | 345 | Section 6 -- Term and Termination. 346 | 347 | a. This Public License applies for the term of the Copyright and 348 | Similar Rights licensed here. However, if You fail to comply with 349 | this Public License, then Your rights under this Public License 350 | terminate automatically. 351 | 352 | b. Where Your right to use the Licensed Material has terminated under 353 | Section 6(a), it reinstates: 354 | 355 | 1. automatically as of the date the violation is cured, provided 356 | it is cured within 30 days of Your discovery of the 357 | violation; or 358 | 359 | 2. upon express reinstatement by the Licensor. 360 | 361 | For the avoidance of doubt, this Section 6(b) does not affect any 362 | right the Licensor may have to seek remedies for Your violations 363 | of this Public License. 364 | 365 | c. For the avoidance of doubt, the Licensor may also offer the 366 | Licensed Material under separate terms or conditions or stop 367 | distributing the Licensed Material at any time; however, doing so 368 | will not terminate this Public License. 369 | 370 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 371 | License. 372 | 373 | 374 | Section 7 -- Other Terms and Conditions. 375 | 376 | a. The Licensor shall not be bound by any additional or different 377 | terms or conditions communicated by You unless expressly agreed. 378 | 379 | b. Any arrangements, understandings, or agreements regarding the 380 | Licensed Material not stated herein are separate from and 381 | independent of the terms and conditions of this Public License. 382 | 383 | 384 | Section 8 -- Interpretation. 385 | 386 | a. For the avoidance of doubt, this Public License does not, and 387 | shall not be interpreted to, reduce, limit, restrict, or impose 388 | conditions on any use of the Licensed Material that could lawfully 389 | be made without permission under this Public License. 390 | 391 | b. To the extent possible, if any provision of this Public License is 392 | deemed unenforceable, it shall be automatically reformed to the 393 | minimum extent necessary to make it enforceable. If the provision 394 | cannot be reformed, it shall be severed from this Public License 395 | without affecting the enforceability of the remaining terms and 396 | conditions. 397 | 398 | c. No term or condition of this Public License will be waived and no 399 | failure to comply consented to unless expressly agreed to by the 400 | Licensor. 401 | 402 | d. Nothing in this Public License constitutes or may be interpreted 403 | as a limitation upon, or waiver of, any privileges and immunities 404 | that apply to the Licensor or You, including from the legal 405 | processes of any jurisdiction or authority. 406 | 407 | 408 | ======================================================================= 409 | 410 | Creative Commons is not a party to its public licenses. 411 | Notwithstanding, Creative Commons may elect to apply one of its public 412 | licenses to material it publishes and in those instances will be 413 | considered the “Licensor.” The text of the Creative Commons public 414 | licenses is dedicated to the public domain under the CC0 Public Domain 415 | Dedication. Except for the limited purpose of indicating that material 416 | is shared under a Creative Commons public license or as otherwise 417 | permitted by the Creative Commons policies published at 418 | creativecommons.org/policies, Creative Commons does not authorize the 419 | use of the trademark "Creative Commons" or any other trademark or logo 420 | of Creative Commons without its prior written consent including, 421 | without limitation, in connection with any unauthorized modifications 422 | to any of its public licenses or any other arrangements, 423 | understandings, or agreements concerning use of licensed material. For 424 | the avoidance of doubt, this paragraph does not form part of the public 425 | licenses. 426 | 427 | Creative Commons may be contacted at creativecommons.org. 428 | --------------------------------------------------------------------------------