Git¶
Git installation process¶
The first step is to install Git on your WSL.
Enter the following command in your terminal:
sudo apt install git
Git Workflow Guide¶
1. Preparation (Local Work)¶
These steps are done on your local machine before interacting with the remote repository.
Command |
Purpose |
|---|---|
|
Check the current state of your working directory and staging area. |
|
Stage all changes in the current directory, preparing them for a commit. |
|
Permanently save the staged changes into your local repository history. |
2. Synchronization (Pulling Remote Changes)¶
These commands are used to bring new changes from the shared remote repository to your local branch.
Command |
Purpose |
|---|---|
|
Downloads new data and commits from the remote repository but does not modify your local files or branches. |
|
Downloads remote changes (fetch) AND immediately integrates them into your current local branch (merge). This is the command that most often triggers a conflict. |
3. Handling Conflicts (If git pull Fails)¶
If git pull results in a merge conflict, the following steps are required:
Command |
Purpose |
|---|---|
|
Shows which files are currently in an ‘unmerged’ (conflicted) state. |
Manual Edit |
Open the conflicted file(s), remove the Git markers ( |
|
Stages the manually corrected file, signaling to Git that you have finished resolving that specific conflict. |
|
Completes the merge process by creating the final merge commit. Git usually pre-fills the message for you. |