Git Workflow
In this section, we describe the typical Git workflow and indicate where users commonly have trouble.
One-Time Steps
- First, install Git tools.
- Next, configure your git installation to set your username and password.
Steps for Working on Projects
- Make sure you have completed the one-time steps for installing and configuring Git on your machine.
- When you first begin working on a project, you will need to clone your NCSU GitHub repository.
- Next, you will either need to:
- Share your existing Eclipse project to your repository, OR
- Import an existing Eclipse project from your NCSU GitHub repository.
- If your project doesn’t already include a .gitignore file, create a .gitignore file.
- Typically, you will now begin writing code or continue editing existing code.
- If you are working on a team that shares a common repository, you should frequently pull any updates your team members push to the team’s NCSU GitHub repository. If the pull results in CONFLICTING code, you will need to resolve merge conflicts.
- Once you are ready to save a snapshot of your code to your repository, you need to add the files you want to save in the snapshot to your staging area/index.
- After staging your commit by adding files to your staging area/index, you need to commit your staged snapshot to your local repository.
- To send your local repository’s commit snapshots to your NCSU GitHub remote repository, you will need to push your local commit snapshots. If you experience
fetch-first
ornon-fast-forward
errors, try to pull before you push. - Repeat with step 4 to continue working on your project.