diff --git a/_posts/Guide/GitAndGithub/define.json b/_posts/Guide/GitAndGithub/define.json new file mode 100644 index 0000000..8f058e2 --- /dev/null +++ b/_posts/Guide/GitAndGithub/define.json @@ -0,0 +1,4 @@ +{ + "title": "Git and GitHub", + "position": 1 + } \ No newline at end of file diff --git a/_posts/Guide/GitAndGithub/github.mdx b/_posts/Guide/GitAndGithub/github.mdx new file mode 100644 index 0000000..3345624 --- /dev/null +++ b/_posts/Guide/GitAndGithub/github.mdx @@ -0,0 +1,85 @@ +--- +title: "A guide to Github" +description: "getting started with github and creating new repository" +tags: ["github"] +date: 29 April 2023 +position: 2 +--- + +GitHub is a web-based platform for software developers to host, manage, and collaborate on their code. + +## Some terms used to contribute open source +- Fork: A fork is a copy of a repository that you create on your own account. You can use a fork to make changes to the repository without affecting the original project. + +- Clone: Cloning creates a local copy of a Git repository on your machine. + +- Branch: A branch is a parallel version of a repository that allows you to make changes without affecting the main codebase. This is useful when working on new features or bug fixes. + +- Pull request: A pull request is a request to merge changes from one branch to another. When you make changes to a forked repository, you can submit a pull request to the original project owner to incorporate your changes. + +- Merge: Merging combines changes from one branch into another. When a pull request is accepted, the changes are merged into the main branch of the repository. + +- Commit: A commit is a record of changes to a repository. Each commit has a unique identifier and includes information about the changes made. + +- Issue: An issue is a problem, bug, or feature request that needs to be addressed in a repository. Issues can be opened by anyone and are tracked on the GitHub platform. + +- Repository: A repository is a collection of files and code that are stored together in Git. It contains all the project files, including the code, README file, and other documentation, as well as the history of changes made to the code. + +- Pull: Pulling retrieves the latest changes from a remote repository and updates your local repository with those changes. + +# Creating a repository +## On GitHub +- Log in to your GitHub account +- Click on the "+" icon on the top-right side of the dashboard and select "New repository" +![NewRepo](/images/newrepo.png) +- Enter the repository name, description, and choose whether the repository should be public or private +- Select "Initialize this repository with a README" if you want GitHub to automatically create a README file for you +- Choose a license for your repository (optional) +- Click on "Create repository" + +## Using Local Git +- Open a terminal/command prompt and navigate to the directory where you want to create your repository. +- Run the following command to initialize a new Git repository in the current directory: +```git +git init +``` +- Create a new file in the repository directory and add some content to it. +- Add the file to the staging area using the following command: +```git +git add . +``` +- Commit the changes using the following command: +```git +git commit -m "Initial commit" +``` +- If you have already created GitHub Repository, +Link your local repository to the remote repository using the following command: +```git +git remote add origin +``` +Replace `remote repository URL` with the URL of your remote repository. +- Push the changes from your local repository to the remote repository using the following command: +```git +git push -u origin master +``` + +# Cloning the GitHub Repository +- First, navigate to the GitHub repository you want to clone. + +- Click on the green "Code" button located on the right side of the repository page. +![CloneRepo](/images/clonerepo.png) + +- Next, click on the clipboard icon to copy the URL of the repository. + +- Open your terminal or command prompt on your computer. + +- Navigate to the directory where you want to clone the repository using the command cd [directory name]. + +- Once you’re in the right directory, use the git clone command followed by the URL you copied earlier. For example +```git +git clone https://github.com/[username]/[repository-name].git +``` + +- Press enter and wait for Git to clone the repository onto your computer. + +# Fork a repository on GitHub diff --git a/_posts/Guide/GitAndGithub/starting-with-git.mdx b/_posts/Guide/GitAndGithub/starting-with-git.mdx new file mode 100644 index 0000000..fab23b0 --- /dev/null +++ b/_posts/Guide/GitAndGithub/starting-with-git.mdx @@ -0,0 +1,59 @@ +--- +title: "Starting with git" +description: "getting started with git" +tags: ["git"] +date: 29 April 2023 +position: 1 +--- + +Git is a version control system (VCS) that allows developers to manage the changes made to their code over time. +VCSs are essential tools for software development, as they enable collaboration, versioning, and backup of code. + +Traditional version control systems like CVS or Subversion were centralized, meaning that there was a central repository where all the code was stored. +Developers would check out a copy of the code from the repository, make changes, and then commit those changes back to the repository. While this approach worked well for small teams, it had limitations for larger projects or distributed teams, as it required constant network connectivity to access the central server. +Git, on the other hand, is a distributed version control system. This means that every developer has a full copy of the repository on their local machine. They can work on the code locally, make changes, and commit them without needing to connect to a central server. Once they're ready, they can push their changes to a remote repository where other team members can pull in the changes. + +Git was created by Linus Torvalds in 2005 as a tool to manage the Linux kernel development. It quickly became popular due to its speed, flexibility, and powerful branching model. Today, Git is one of the most widely used version control systems in the world, powering millions of software development projects ranging from small personal projects to large-scale enterprise applications. + +# Installing Git on your machine + +## MacOS +Install [homebrew](https://brew.sh/) if you don't already have it, then: +```bash +brew install git +``` + +[Follow official guide for more details](https://git-scm.com/download/mac) + +## Linux +### Debian +- Open the Terminal and enter the command to update the package list +```bash +sudo apt update +``` +- Enter the command to install Git +```bash +sudo apt install git +``` + +### Fedora +Open the Terminal and enter the command +```bash +sudo dnf install Git +``` + +### Arch Linux +Open the Terminal and enter the command +```bash +sudo pacman -Syu git +``` + +## Windows +Sorry Guys, but intall Linux on your machine :) + +# Configure Git +After installing Git, open the terminal/command prompt and configure your user name and email address using these commands: +```git +git config --global user.name "Your Name" +git config --global user.email "youremail@example.com" +``` \ No newline at end of file diff --git a/_posts/Guide/define.json b/_posts/Guide/define.json new file mode 100644 index 0000000..219f743 --- /dev/null +++ b/_posts/Guide/define.json @@ -0,0 +1,4 @@ +{ + "title": "Guide", + "position": 9999 + } \ No newline at end of file diff --git a/_posts/Guide/markdown.mdx b/_posts/Guide/markdown.mdx new file mode 100644 index 0000000..1bbde84 --- /dev/null +++ b/_posts/Guide/markdown.mdx @@ -0,0 +1,7 @@ +--- +title: "Markdown Guide" +description: "getting started with markdown and readme files" +tags: ["md"] +date: 29 April 2023 +position: 3 +--- \ No newline at end of file diff --git a/public/images/clonerepo.png b/public/images/clonerepo.png new file mode 100644 index 0000000..fb3b9d2 Binary files /dev/null and b/public/images/clonerepo.png differ diff --git a/public/images/newrepo.png b/public/images/newrepo.png new file mode 100644 index 0000000..b1a1a80 Binary files /dev/null and b/public/images/newrepo.png differ