aboutsummaryrefslogtreecommitdiff
path: root/uag/records/docs/git.md
blob: 0172697cb0e5f00da85fe22c36b240b65730c0a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Git Setup Guide

This guide will help you install and configure Git so you can contribute to the records repository.

## What is Git?

Git is a version control system that tracks changes to files. It allows multiple people to work on the same project without overwriting each other's work, and keeps a complete history of all changes.

## Installing Git

### Windows

1. Download the Git installer from [git-scm.com](https://git-scm.com/download/win)
2. Run the downloaded `.exe` file
3. Follow the installation wizard:
   - Accept the license agreement
   - Use the default installation location (or choose your own)
   - **Important settings to note:**
     - Select "Git from the command line and also from 3rd-party software"
     - Select "Use Visual Studio Code as Git's default editor" (if you have VS Code)
     - Select "Override the default branch name" and set it to `main`
     - Keep other settings as default
4. Click **Install** and wait for it to complete
5. Click **Finish**

### Verify Installation

Open a terminal (Command Prompt, PowerShell, or VS Code terminal) and run:

```bash
git --version
```

You should see something like `git version 2.x.x`.

## First-Time Git Configuration

Before you can use Git, you need to tell it who you are. Run these commands in your terminal (replace with your actual information):

```bash
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
```

## Cloning the Repository

"Cloning" means downloading a copy of the repository to your computer.

1. Open a terminal
2. Navigate to where you want to store the project:
   ```bash
   cd C:\Users\YourName\Documents
   ```
3. Clone the repository:
   ```bash
   git clone <repository-url>
   ```
4. Enter the project folder:
   ```bash
   cd records
   ```

## Basic Git Workflow

Here's the typical workflow when making changes:

### 1. Check Your Status

See what files have changed:

```bash
git status
```

### 2. Pull Latest Changes

Before making changes, always get the latest version:

```bash
git pull
```

### 3. Make Your Changes

Edit or create files as needed (see [attendance.md](attendance.md) for attendance-specific instructions).

### 4. Stage Your Changes

Tell Git which files you want to include in your commit:

```bash
# Add a specific file
git add records/attendance/260131.json

# Or add all changed files
git add .
```

### 5. Commit Your Changes

Save your changes with a descriptive message:

```bash
git commit -m "Add attendance for session 260131"
```

### 6. Push Your Changes

Upload your changes to the remote repository:

```bash
git push
```

## Common Issues

### "Permission denied" or Authentication Errors

You may need to set up authentication. The easiest way is:

1. When prompted, enter your username
2. For the password, you'll likely need a **Personal Access Token** instead of your actual password
   - Check your Git hosting platform's documentation for creating tokens

### "Please tell me who you are"

Run the configuration commands from the [First-Time Git Configuration](#first-time-git-configuration) section.

### Merge Conflicts

If someone else changed the same file you did:

1. Git will tell you there's a conflict
2. Open the conflicting file and look for markers like `<<<<<<< HEAD`
3. Edit the file to resolve the conflict
4. Save, then `git add` and `git commit` the resolved file

## Need More Help?

- [Official Git Documentation](https://git-scm.com/doc)
- [GitHub's Git Guides](https://github.com/git-guides)
- Ask a team member for assistance