GITLAB PUSH
Checking Git Version Before starting with any Git operations, it’s essential to check if Git is installed correctly on your system. The following command will show you the version of Git installed: git --version Initializing a Git Repository (git init) To start tracking a project using Git, you need to initialize a new Git repository in your project directory. This can be done with the git init command. Navigating to your Project Directory: Before using Git, navigate to your project directory: cd command Initialize Git Repository: Once you’re in the project directory, run the following command to initialize a Git repository: git init Git Configuration After that, configure your username and email: git config --global user.name "your Name" git config --global user.email "your.email@example.com" Forking and Cloning a Repository Forking is a repository means creating a copy of an existing repository in your GitHub account so that we can make changes without affecting the original repository. How to Fork a Repository Go to the repository we want to contribute to on GitHub. Click the Fork button at the top right. Once forked, navigate to your GitHub profile and open the forked repository Copy URL: Then a copy of real repository will be created in your local repository. After that, we have to copy the URL from your local repo. For doing that click to code and copy the URL. Cloning the Repository Locally After forking, clone the repository to your local machine Create a folder on your desktop where you want to store the project files. Open Git Bash and navigate to the newly created folder using the cd command: cd Copy the repository URL from GitHub. In Git Bash, type the following command and press Enter git clone The repository will be cloned into your desktop folder, making the project files available on your system. Checking the Status After making code changes, check which files are not added using: git status This command displays the current state of your working directory, indicating whether files are untracked, staged, or committed. Files in red are untracked or modified but not staged, while files in green are staged and ready to be committed. Adding Files to Staging Area When we get to know which files are not added by typing git status(red-colored files are not added). To track a file or prepare changes for commit: git add To add all changes: git add . Committing Changes To save your changes in the local repository, first check the status using: git status Files displayed in green are staged but not yet committed. To commit these changes, use: git commit -m "Your commit message" Pushing Changes to GitHub To upload commits to your forked repository git push origin

- Checking Git Version
Before starting with any Git operations, it’s essential to check if Git is installed correctly on your system. The following command will show you the version of Git installed:
git --version
- Initializing a Git Repository (git init)
To start tracking a project using Git, you need to initialize a new Git repository in your project directory. This can be done with the git init command.
Navigating to your Project Directory: Before using Git, navigate to your project directory:
cd command
Initialize Git Repository: Once you’re in the project directory, run the following command to initialize a Git repository:
git init
- Git Configuration
After that, configure your username and email:
git config --global user.name "your Name"
git config --global user.email "your.email@example.com"
- Forking and Cloning a Repository
Forking is a repository means creating a copy of an existing repository in your GitHub account so that we can make changes without affecting the original repository.
How to Fork a Repository
Go to the repository we want to contribute to on GitHub.
Click the Fork button at the top right.
Once forked, navigate to your GitHub profile and open the forked repository
Copy URL: Then a copy of real repository will be created in your local repository. After that, we have to copy the URL from your local repo. For doing that click to code and copy the URL.
- Cloning the Repository Locally
After forking, clone the repository to your local machine
Create a folder on your desktop where you want to store the project files.
Open Git Bash and navigate to the newly created folder using the cd command:
cd
Copy the repository URL from GitHub.
In Git Bash, type the following command and press Enter
git clone
The repository will be cloned into your desktop folder, making the project files available on your system.
- Checking the Status
After making code changes, check which files are not added using:
git status
This command displays the current state of your working directory, indicating whether files are untracked, staged, or committed. Files in red are untracked or modified but not staged, while files in green are staged and ready to be committed.
- Adding Files to Staging Area
When we get to know which files are not added by typing git status(red-colored files are not added).
To track a file or prepare changes for commit:
git add
To add all changes:
git add .
-
Committing Changes
To save your changes in the local repository, first check the status using:
git status
Files displayed in green are staged but not yet committed. To commit these changes, use:
git commit -m "Your commit message"
- Pushing Changes to GitHub
To upload commits to your forked repository
git push origin