What is GitHub?
- GitHub is a platform where developers can collaborate, store, and share their code, making it easier for teams to work together on projects.
- While running a business, you use a variety of digital tools, from email design tools to analytics platforms. In many cases, that means using tools other people or companies have created.
- But sometimes you might want to modify those tools or create your own company tools.
- In either of those cases, you’ll need to have basic knowledge of coding, as all digital tools and websites are fundamentally built on code.
- But if you’re not an expert at editing raw code, you might want a platform that will help you with the process.
GitHub workflow:
Create a Repository:
- Log in to your GitHub account.
- Click on the + icon in the top-right corner.
- Select New repository.
- Fill in the repository name, description, and other details.
- Click Create repository.
Initialize a Git Repository:
- Open a terminal or command prompt.
- Navigate to the project directory.
- Run the command git init to initialize a new Git repository.?
Add Files to the Repository:
- Run the command git add . to stage all files in the project directory.
- Run the command git status to verify the files that have been staged.
Commit Changes:
- Run the command git commit -m "Initial commit" to commit the changes with a meaningful commit message.?
Link the Local Repository to GitHub:
- Run the command git remote add origin https://github.com/username/repository.git to link the local repository to the GitHub repository.
- Run the command git push -u origin master to push the changes to the GitHub repository.?
Create a New Branch:
- Run the command git branch feature/new-feature to create a new branch for a new feature.
- Run the command git checkout feature/new-feature to switch to the new branch.
Make Changes and Commit:
- Make changes to the code.
- Run the command git add . to stage the changes.
- Run the command git commit -m "Added new feature" to commit the changes.
?Push Changes to GitHub:
- Run the command git push origin feature/new-feature to push the changes to the GitHub repository.
Create a Pull Request:
- Log in to your GitHub account.
- Navigate to the repository.
- Click on the "Pull requests" tab.
- Click on the "New pull request" button.
- Select the branch that you want to merge into the main branch.
- Fill in the pull request title and description.
- Click "Create pull request".
Review and Merge the Pull Request:
- Review the pull request.
- Make comments or suggestions.
- Click "Merge pull request" to merge the changes into the main branch.
Delete the Branch:
- Run the command git branch -d feature/new-feature to delete the branch.
Repeat the Cycle:
- Repeat the cycle for new features, bug fixes, or other changes.
Benefits of Using GitHub:
Version Control ??:
- Tracks changes in code, making it easy to revert to previous versions.
- Maintains a complete history of modifications.
Collaboration & Teamwork ??:
- Allows multiple developers to work on the same project.
- Features like pull requests and code reviews improve team collaboration.
Backup & Security ??:
- Cloud storage ensures code safety even if local files are lost.
- Private repositories protect sensitive projects.
Open source Contribution??:
- Enables developers to contribute to open-source projects.
- Encourages knowledge sharing and networking.
GitHub Actions & Automation:
- Automates testing, deployment, and CI/CD workflows.
- Reduces manual effort and increases efficiency.
Project Management Tools:
- Issues, milestones, and project boards help in tracking tasks.
- Enhances workflow for Agile and DevOps teams.
Portfolio Building:
A strong GitHub profile showcases skills to potential employers.
Contributing to repositories demonstrates real-world experience.
- Integration with DevOps & Tools ??? Seamless integration with Jenkins, Docker, AWS, and more. Enhances productivity in software development pipelines.
- Code Hosting & Deployment: GitHub Pages allows hosting static websites directly from repositories. Simplifies deployment with third-party integrations.
- Community Support ??
- Large developer community for learning and troubleshooting.
- Access to countless open-source projects and resources.
GitHub Plans:
Free:
- GitHub offers a free plan, which includes unlimited public repositories and collaborators.
Pro:
- GitHub's Pro plan includes additional features, such as private repositories and advanced collaboration tools.
Team:
- GitHub's Team plan includes features such as organization-wide permissions and advanced project management tools.
Enterprise:
- GitHub's Enterprise plan includes features such as single sign-on and advanced security?controls.