In this section, we describe the typical Git workflow and indicate where users commonly have trouble.
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:
- 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
non-fast-forwarderrors, try to pull before you push.
- Repeat with step 4 to continue working on your project.