Update Version Control and Git Workflow

sashaastiadi 2024-10-30 14:03:12 +00:00
parent d9e6d9a0a7
commit caf9d2ce33

@ -1,67 +1,81 @@
# Version Control and Git Workflow
# Collaboration and Git Workflow
Version control is essential for managing changes to your website's code and content. Using Git allows multiple team members to collaborate effectively, track changes, and maintain the integrity of your projects. This guide outlines the key steps to manage repositories using Git within the ThreeFold ecosystem.
In the ThreeFold web repository, if youre not the repo owner, follow this collaboration guide to ensure smooth contributions. This guide assumes a basic understanding of Git for cloning, editing, committing, and merging. If you're new to Git, refer to the official GitHub guides for more information.
## Cloning a Repository
## Key Principles for Working with Branches
To start working on a project, you'll first need to clone the repository to your local machine. This allows you to create your own copy of the project to work on.
Read
We work with branches in Git, which are isolated environments within a repository. Branching allows you to make changes without affecting the main codebase. When your changes are complete and reviewed, they are merged back into the main branch.
### Steps to Clone a Repository
## Basic Workflow for Collaborating on the Repository
Open your Terminal (Command Prompt or Git Bash).
Navigate to your desired directory where you want to clone the repository using the cd command. For example:
### Step 1: Clone the Repository
Open Terminal or Command Prompt.
Navigate to your directory where you want to clone the repository:
```bash
cd path/to/your/directory
Clone the Repository: Use the following command to clone the repository:
```
Clone the Repository:
Copy code
```bash
git clone https://git.ourworld.tf/your_repo_url.git
```
Navigate into the Cloned Repository:
Enter the Cloned Repository:
```bash
cd your_repo_name
```
For detailed Git commands and workflows, check out the [Github guide](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)
For more on cloning, refer to the GitHub guide on cloning a repository.
### Open Your Code Editor
### Step 2: Open in a Code Editor
To edit your files, you'll need a code editor. A popular choice is Visual Studio Code (VS Code).
A preferred code editor, like Visual Studio Code (VS Code), is useful for editing files.
#### Download VS Code
Download VS Code: Download here.
You can download Visual Studio Code from the official website: [Download VS Code](https://code.visualstudio.com/).
Open your cloned project:
### Finding Content
In VS Code, use the “File” menu and select “Open Folder…” to locate and open your project.
Once you have your code editor open, navigate to the folder where your content is stored. Typically, youll find the content in the `src` or `content` folder of your project.
### Step 3: Create a New Branch
Always make changes on a new branch to keep the development process organized.
#### Steps to Find Content
Create a Branch from development:
1. **Open the Project in VS Code**:
- Use the “File” menu and select “Open Folder…” to locate and open your cloned project.
```bash
git checkout -b your_branch_name development
```
2. **Explore the Folder Structure**:
- Look for the `src` or `content` folder, which contains the files you need to edit.
### Step 4: Make Edits and Commit Changes
### Making Changes
Edit Files: Make necessary changes in your branch.
Now that you've found the content you want to edit, you can make your changes.
Save Changes: In VS Code, use Ctrl + S (or Cmd + S on Mac) to save.
#### Steps to Save Your Changes
Stage and Commit:
1. **Edit the Files**:
- Make the necessary changes in your code or content files.
```bash
git add .
git commit -m "Descriptive commit message"
```
2. **Save Your Changes**:
- Use `Ctrl + S` (or `Cmd + S` on Mac) to save your changes in VS Code.
###Step 5: Push Changes and Create a Pull Request
### Using Branches
Push your branch:
Before pushing your changes to the main repository, its essential to work on a separate branch to keep the development process organized and collaborative.
```bash
git push origin your_branch_name
```
#### Steps for Branching
Create a Pull Request:
Go to https://git.ourworld.tf/thereponame and create a pull request from your branch to the development branch.
1. **Create a New Branch**:
Always create a new branch from the `development` branch before making changes. Use the following command:
Request a Merge:
Notify the web presence admin to review and merge your changes. Do not merge them yourself.
git checkout -b your_branch_name
### Important Donts
Do not commit directly to the development or main branches