{"id":18623750,"url":"https://github.com/clifftech123/git-and-github-for-beginners","last_synced_at":"2025-05-07T11:07:01.705Z","repository":{"id":142189835,"uuid":"612716052","full_name":"Clifftech123/Git-and-GitHub-for-Beginners","owner":"Clifftech123","description":"From Beginner to Advanced  Comprehensive Guide to Git and GitHub","archived":false,"fork":false,"pushed_at":"2023-03-22T20:32:22.000Z","size":124,"stargazers_count":11,"open_issues_count":1,"forks_count":11,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-07T04:31:44.250Z","etag":null,"topics":["collaboration","git","github","team"],"latest_commit_sha":null,"homepage":"","language":"Markdown","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Clifftech123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-11T19:06:27.000Z","updated_at":"2024-07-17T17:34:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"9bb03472-bfaa-4d23-9ba7-9553d1af67f0","html_url":"https://github.com/Clifftech123/Git-and-GitHub-for-Beginners","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clifftech123%2FGit-and-GitHub-for-Beginners","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clifftech123%2FGit-and-GitHub-for-Beginners/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clifftech123%2FGit-and-GitHub-for-Beginners/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clifftech123%2FGit-and-GitHub-for-Beginners/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Clifftech123","download_url":"https://codeload.github.com/Clifftech123/Git-and-GitHub-for-Beginners/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231441622,"owners_count":18377330,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["collaboration","git","github","team"],"created_at":"2024-11-07T04:25:57.860Z","updated_at":"2024-12-27T05:22:31.843Z","avatar_url":"https://github.com/Clifftech123.png","language":"Markdown","readme":"\n![Git \u0026 GitHub for Beginners](image/image8_0e61d0dad8.png)\n\nWelcome to Git \u0026 GitHub for Beginners! This guide is designed to help you get started with Git \u0026 GitHub. It will help you to understand the basics of Git \u0026 GitHub and to get you started with using Git \u0026 GitHub.\n\n\n\n\n## Table of Contents\n\n- [What is this?](#what-is-this)\n- [Why?](#why)\n- [Who is this for?](#who-is-this-for)\n- [Notes](#notes)\n- [Assumptions](#assumptions)\n- [Terms](#terms)\n- [What is GitHub?](#what-is-github)\n- [What is GitHub used for?](#what-is-github-used-for)\n- [What is Git?](#what-is-git)\n- [Common tasks you need to do with Git](#common-tasks-you-need-to-do-with-git)\n- [How to install Git](#how-to-install-git)\n- [How to configure Git](#how-to-configure-git)\n- [How to create a repository](#how-to-create-a-repository)\n- [How to clone a repository](#how-to-clone-a-repository)\n- [How to create a branch](#how-to-create-a-branch)\n- [How to make changes to a file](#how-to-make-changes-to-a-file)\n- [How to stage changes](#how-to-stage-changes)\n- [How to commit changes](#how-to-commit-changes)\n- [How to push changes to a remote repository](#how-to-push-changes-to-a-remote-repository)\n- [How to create a pull request](#how-to-create-a-pull-request)\n- [How to merge a pull request](#how-to-merge-a-pull-request)\n- [How to resolve merge conflicts](#how-to-resolve-merge-conflicts)\n- [How to revert a commit](#how-to-revert-a-commit)\n- [How to delete a branch](#how-to-delete-a-branch)\n\n\n## What is this?\n\n- A guide to Git \u0026 GitHub for beginners\n- A collection of resources to help you learn Git \u0026 GitHub\n- A place to ask questions and get help\n\n## Why?\n\n- I've been using Git \u0026 GitHub for a few years now and I've found it to be a really useful tool.- I've used it to collaborate with others on projects, to keep track of changes to my code, and to revert to previous versions of my code when I've made a mistake\n- I've also found that there are a lot of resources out there that are either too basic or too advanced\n- I wanted to create a guide that would help people who are new to Git \u0026 GitHub to get started and to help them to understand the basics of Git \u0026 GitHub\n\n## Who is this for?\n\n- Those who are yet to land their first job in tech\n- Those who have recently landed their first job in tech\n- Those who are looking to improve their skills\n- Those who are looking to learn a new skill\n- Those who are looking to get a better understanding of Git \u0026 GitHub\n\n## Notes\n\n- There are different Git workflows - Trunk, GitFlow, GitHubFlow\n- This guide is based on the GitHubFlow workflow\n\n\n## Assumptions\n\n- You have a [GitHub account](https://github.com/)\n- You have [Git installed](https://git-scm.com/)\n- You have a [text editor](https://code.visualstudio.com/) installed\n- You have [Node.js](https://nodejs.org/en/) installed\n\n## Terms\n\n- Branch - A version of the codebase\n- Commit - A unit of change\n- Stage\n- Merge - Combining two branches\n- Pull Request - A request to merge a branch into another branch\n- Fork - A copy of a repository\n- Clone - A copy of a repository on your local machine\n- Remote - A copy of a repository on a remote server\n- Origin - The default remote name given to a repository when it is cloned\n- Upstream - The original repository that was cloned\n- Master - The default branch name given to a repository when it is created\n- Repository - A directory that contains all of the files for a project\n- Working Directory - The directory that contains the files that you are working on\n- Staging Area - The directory that contains the files that are ready to be committed\n- Index - The directory that contains the files that are ready to be committed\n- HEAD - The current branch that you are working on\n- Checkout - Switching between branches\n- Push - Sending your commits to a remote repository\n- Pull - Fetching and merging changes on a remote repository to your local repository\n- Fetch - Fetching changes on a remote repository to your local repository\n\n## What is GitHub?\n\n![Github](image/GitHub-Logo.png)\n\n- GitHub is a code hosting platform for version control and collaboration\n- It lets you and others work together on projects from anywhere\n- This tutorial teaches you GitHub essentials like repositories, branches, commits, and Pull Requests\n- You’ll create your own Hello World repository and learn GitHub’s Pull Request workflow, a popular way to create and review code\n- You’ll also learn about issues, GitHub’s powerful tracking tools for every bug and feature request that comes your way\n\n## What is GitHub used for?\n\n- GitHub is a code hosting platform for version control and collaboration\n- It lets you and others work together on projects from anywhere\n- You can use GitHub to store and share your code, track and assign issues, and manage pull requests\n- You can also use GitHub to create your own website using GitHub Pages\n- GitHub is a great way to collaborate with others on projects\n\n## What is Git?\n\n![Git](image/68747470733a2f2f6769742d73636d2e636f6d2f696d616765732f6c6f676f732f646f776e6c6f6164732f4769742d4c6f676f2d32436f6c6f722e706e67.png)\n\n- Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency\n- Git is easy to learn and has a tiny footprint with lightning fast performance\n- It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows\n- Git was initially designed and developed by Linus Torvalds for Linux kernel development\n\n- Git is a version control system\n- Allows you to track changes to your code over time\n- Enables you to collaborate with others on the same codebase\n- You can easily revert to a previous version of your code or experiment with new features without affecting the main codebase\n- Provides a record of all changes made to your code, including who made them and when, which can be useful for auditing and debugging\n\n## Common tasks you need to do with Git\n\n- Create a repository\n- Create a branch\n- Make changes to a file\n- Stage changes\n- Commit changes\n- Push changes to a remote repository\n- Merge changes\n- Revert changes\n- Delete a branch\n\n\n## How to install Git\n\n- [Download Git](https://git-scm.com/downloads)\n- [Install Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)\n\n## How to configure Git\n\n- `git config --global user.name \"Your Name\"` - Set a name that is identifiable for credit when review version history\n\n```bash\n\n# Set a name that is identifiable for credit when review version history\n\n$ git config --global user.name \"Your Name\"\n\n```\n\n- `git config --global user.email \"\n\n- Set an email address that will be associated with each history marker\n\n```bash\n\n# Set an email address that will be associated with each history marker\n\n$ git config --global user.email \"\n\n```\n\n- `git config --global color.ui auto` - Set automatic command line coloring for Git for easy reviewing\n\n```bash\n\n# Set automatic command line coloring for Git for easy reviewing\n\n$ git config --global color.ui auto\n\n```\n\n- `git config --global core.editor \"code --wait\"` - Set the default editor for Git\n\n```bash\n\n# Set the default editor for Git\n\n$ git config --global core.editor \"code --wait\"\n\n```\n\n- `git config --global init.defaultBranch main` - Set the default branch name to main\n\n```bash\n\n# Set the default branch name to main\n\n$ git config --global init.defaultBranch main\n\n```\n\n\n\n\n\n\n\n## Git commands\n\n- `git init` - Create a new local repository\n\n```bash\n# Create a new directory called my-project\n\n$ git init my-project\n\n```\n\n- `git status` - Show the status of the current branch\n\n```bash\n#  Check the status of the current branch\n\n$ git status  # On branch master\n\n```\n\n- `git clone` - Clone a repository that already exists on GitHub to your local machine\n\n```bash\n\n#Clone a repository that already exists on GitHub to your local machine\n\n\n$ git clone  project-name # Cloning into `project-name`...\n\n# make sure to copy the URL from the repository you want to clone\n\n```\n\n- `git add` - Add files to the staging area\n\n```bash\n\n\n# Add files to the staging area\n\n\n$ git add . # Changes to be committed:\n# when you add the dot, it adds all the files in the current directory\n\n$ git add file-name # Changes to be committed:\n\n# when you add the file name, it adds the file with the name you specified\n\n\n```\n\n- `git commit` - Commit changes to head (but not yet to the remote repository)\n\n```bash\n\n# Commit changes to head (but not yet to the remote repository)\n\n\n$ git commit -m \"Commit message\" # [master (root-commit) 1a2b3c4] Commit message\n\n\n```\n\n- `git push` - Push changes to remote repository (eg. GitHub)\n\n```bash\n\n# Push changes to remote repository (eg. GitHub)\n\n$ git push origin master # Pushing to\n\n```\n\n- `git pull` - Fetch and merge changes on the remote server to your working directory\n\n```bash\n\n# Fetch and merge changes on the remote server to your working directory\n\n\n$ git pull origin master # Updating 1a2b3c4..3d4e5f6\n# Fast-forward\n#  README | 1 +\n#  1 file changed, 1 insertion(+)\n#  create mode 100644 README\n\n```\n\n- `git fetch` - Fetch changes on the remote server to your working directory\n\n```bash\n\n# Fetch changes on the remote server to your working directory\n\n\n$ git fetch origin master # remote: Counting objects: 5, done.\n\n```\n\n- `git merge` - Merge a branch into the branch you are currently on\n\n````bash\n\n\n# Merge a branch into the branch you are currently on\n\n$ git merge branch-name # Updating 1a2b3c4..3d4e5f6\n\n\n\n- `git branch` - List, create, or delete branches\n\n```bash\n\n# List, create, or delete branches\n\n\n$ git branch # * master\n#  test\n\n$ git branch branch-name # * master\n#  branch-name\n#  test\n\n$ git branch -d branch-name # Deleted branch branch-name (was 1a2b3c4).\n\n````\n\n- `git checkout` - Switch branches or restore working tree files\n\n```bash\n\n# Switch branches or restore working tree files\n\n\n$ git checkout branch-name # Switched to branch 'branch-name'\n\n$ git checkout -b branch-name # Switched to a new branch 'branch-name'\n\n```\n\n- `git remote` - Manage set of tracked repositories\n\n```bash\n\n# Manage set of tracked repositories\n$ git remote -v # origin\n\n\n```\n\n- `git log` - Show commit logs\n\n```bash\n# Show commit logs\n$ git log # commit 1a2b3c4\n\n```\n\n- `git diff` - Show changes between commits, commit and working tree, etc\n\n```bash\n\n   # Show changes between commits, commit and working tree, etc\n\n   $ git diff # diff --git a/README.md b/README.md\n\n```\n\n- `git reset` - Reset current HEAD to the specified state\n\n```bash\n\n# Reset current HEAD to the specified state\n\n\n$ git reset --hard HEAD # HEAD is now at 1a2b3c4\n\n```\n\n- `git rm` - Remove files from the working tree and from the index\n\n```bash\n\n# Remove files from the working tree and from the index\n\n\n$ git rm file-name # rm 'file-name'\n\n```\n\n- `git mv` - Move or rename a file, a directory, or a symlink\n\n```bash\n\n# Move or rename a file, a directory, or a symlink\n\n\n$ git mv file-from file-to # rename file1 =\u003e file2\n\n```\n\n- `git stash` - Stash the changes in a dirty working directory away\n\n```bash\n\n# Stash the changes in a dirty working directory away\n\n\n$ git stash # Saved working directory and index state WIP on master: 1a2b3c4\n\n```\n\n- `git tag` - Create, list, delete or verify a tag object signed with GPG\n\n```bash\n\n# Create, list, delete or verify a tag object signed with GPG\n\n\n$ git tag # v1.0.0\n\n```\n\n## The Git workflow\n\n- Create a repository\n- Create a branch\n- Make changes to a file\n- Stage changes\n- Commit changes\n- Push changes to a remote repository\n- Merge changes\n- Revert changes\n- Delete a branch\n\n## How to create a repository\n\n- `git init` - Create a new local repository\n\n```bash\n\n# Create a new directory called my-project\n\n$ git init my-project\n\n```\n\n- `git clone` - Clone a repository that already exists on GitHub to your local machine\n\n```bash\n\n# Clone a repository that already exists on GitHub to your local machine\n\n$ git clone project-name # Cloning into `project-name`...\n\n\n# make sure to copy the URL from the repository you want to clone\n\n```\n\n## How to make changes to a file\n\n- `git status` - Show the status of the current branch\n\n```bash\n\n# Check the status of the current branch\n\n$ git status # On branch master\n\n```\n\n\n- `git add` - Add files to the staging area\n\n```bash\n\n# Add files to the staging area\n\n$ git add . # Changes to be committed:\n\n# when you add the dot, it adds all the files in the current directory\n\n$ git add file-name # Changes to be committed:\n\n```\n\n- `git commit` - Commit changes to the current branch\n\n```bash\n\n# Commit changes to the current branch\n\n$ git commit -m \"Commit message\" # [master (root-commit) 1a2b3c4] Commit message\n\n```\n\n- `git diff` - Show file differences that haven’t been staged\n\n```bash\n\n# Show file differences that haven’t been staged\n\n$ git diff # diff --git a/README.md b/README.md\n\n```\n\n\n## How to push changes to a remote repository\n\n- `git push` - Push changes to a remote repository\n\n```bash\n\n# Push changes to a remote repository\n\n\n$ git push origin master # Enumerating objects: 3, done.\n# Counting objects: 100% (3/3), done.\n# Writing objects: 100% (3/3), 226 bytes | 226.00 KiB/s, done.\n# Total 3 (delta 0), reused 0 (delta 0)\n# To\n    \n  ```\n\n## How to merge changes\n\n- `git merge` - Merge changes from one branch to another\n\n```bash\n\n# Merge changes from one branch to another\n\n\n$ git merge branch-name # Updating 1a2b3c4..4d5e6f7\n\n```\n\n\n## How to revert changes\n\n- `git revert` - Revert changes to a file\n\n```bash\n\n# Revert changes to a file\n\n\n$ git revert file-name # Revert \"Revert \"Update README.md\"\"\n\n```\n\n## How to delete a branch\n\n- `git branch -d` - Delete a branch\n\n```bash\n\n\n# Delete a branch\n\n\n$ git branch -d branch-name # Deleted branch branch-name (was 1a2b3c4).\n\n```\n\n## How to create a branch\n\n- `git branch` - Create a new branch\n\n```bash\n\n# Create a new branch\n\n\n$ git branch branch-name # Switched to a new branch 'branch-name'\n\n```\n\n## How to view the history of a repository\n\n- `git log` - View the history of a repository\n\n```bash\n\n# View the history of a repository\n\n\n$ git log # commit 1a2b3c4 (HEAD -\u003e master)\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclifftech123%2Fgit-and-github-for-beginners","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclifftech123%2Fgit-and-github-for-beginners","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclifftech123%2Fgit-and-github-for-beginners/lists"}