Skip to content

Latest commit

 

History

History
95 lines (72 loc) · 3.23 KB

getting-started.md

File metadata and controls

95 lines (72 loc) · 3.23 KB

Initialzing Git - Getting Started

Basic Git Operations:

Git provides a vast array of commands for version control, but here are a few fundamental ones:

git init initializes a new Git repository in the current directory. Such as:

git init directoryname

git clone <repository_url> copies a remote repository to your local machine. Such as:

git clone directoryname

git add stages changes made to a file for commit.

git add . 

or

git add filename

git commit -m "<commit_message>" commits the staged changes to the repository. Such as:

git commit -m "a detailed commit message"

git push uploads your committed changes to a remote repository.

git push repositoryname

git pull fetches and merges changes from a remote repository to your local repository.

git pull

Below is a step by step tutorial on how to setup Git on Linux, Windows, and Mac.

Setting up a Git Repository on Linux:

Open a terminal window.

Navigate to the desired directory where you want to create your repository using the cd command. For example, to navigate to the ~/Documents directory, use the following command:

cd ~/Documents

Initialize a new Git repository using the git init command:

git init

Your repository is now set up. You can start adding files, committing changes, and using other Git commands.

Setting up a Git Repository on Windows:

Install Git on your Windows system by downloading it from the official website: https://git-scm.com/download/win. Run the installer and follow the installation steps.

Open Git Bash, which provides a Linux-like command-line environment on Windows.

Navigate to the desired directory where you want to create your repository. For example, to navigate to the Documents directory on your C: drive, use the following command:

cd /c/Documents

Initialize a new Git repository using the git init command:

git init

Your repository is now set up. You can start adding files, committing changes, and using other Git commands.

Setting up a Git Repository on macOS:

Open Terminal on your Mac.

Navigate to the desired directory where you want to create your repository. For example, to navigate to the Documents directory, use the following command:

cd ~/Documents

Initialize a new Git repository using the git init command:

git init

Your repository is now set up. You can start adding files, committing changes, and using other Git commands.

Now that you have set up the Git repository, you can proceed with adding files, making commits, and performing other Git operations using commands such as git add, git commit, git push, etc. Remember to refer to the Git documentation or other Git tutorials for more details on these operations.

Note: The steps provided assume a basic setup for a local Git repository. If you want to set up a remote repository or work with existing repositories on hosting platforms like GitHub or GitLab, additional steps are required.