Loading...

Section

Making Changes on Your Branch

Part of The Prince Academy's AI & DX engineering stack.

Follow The Prince Academy Inc.

Now that you've created a new branch for your feature, it's time to start making changes! Working on a separate branch means your work is isolated from the main project. This is crucial for avoiding conflicts and allowing multiple developers to work on different features simultaneously. Think of it like having a scratchpad where you can experiment without affecting the main document.

The first step is to make sure you are on your new branch. If you're not already there, you'll need to switch to it. You can do this using the git checkout command.

git checkout your-feature-branch-name

Once you're on your branch, you can start editing files, adding new files, or even deleting files, just as you normally would. Git will keep track of all these modifications.

After making some changes, you'll want to stage them. Staging tells Git which changes you want to include in your next commit. You can stage individual files or all modified files.

# Stage a specific file
git add path/to/your/file.txt

# Stage all modified files
git add .

Once your changes are staged, you can commit them. A commit is a snapshot of your project at a specific point in time. It's a good practice to write clear and concise commit messages that explain what changes were made. This will be invaluable when you look back at your commit history later.

git commit -m "Add initial structure for user profile page"

You can repeat this process of making changes, staging, and committing as many times as needed while you work on your feature. Each commit represents a small, manageable step in your development process. Remember, the goal is to keep your commits focused and atomic, addressing a single logical change.

graph TD
    A[Start on main]
    B[Create new branch]
    C[Switch to new branch]
    D[Make changes]
    E[Stage changes]
    F[Commit changes]
    G{More changes?}
    G -- Yes --> D
    G -- No --> H[Work on your feature complete]