Skip to content

Encourage clean PRs when working on existing projects#1785

Open
OracPrime wants to merge 2 commits intoCodeYourFuture:mainfrom
OracPrime:clean_prs
Open

Encourage clean PRs when working on existing projects#1785
OracPrime wants to merge 2 commits intoCodeYourFuture:mainfrom
OracPrime:clean_prs

Conversation

@OracPrime
Copy link
Contributor

Add a new paragraph to encourage trainees to include only the changes for the particular task in a PR, not previous ones too

@netlify
Copy link

netlify bot commented Mar 16, 2026

👷 Deploy request for cyf-curriculum pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 1246d25

@netlify
Copy link

netlify bot commented Mar 16, 2026

👷 Deploy request for cyf-piscine pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 1246d25

@netlify
Copy link

netlify bot commented Mar 16, 2026

👷 Deploy request for cyf-sdc pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 1246d25

@netlify
Copy link

netlify bot commented Mar 16, 2026

👷 Deploy request for cyf-common pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 1246d25

@netlify
Copy link

netlify bot commented Mar 16, 2026

👷 Deploy request for cyf-itd pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 1246d25

@netlify
Copy link

netlify bot commented Mar 16, 2026

👷 Deploy request for cyf-tracks pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 1246d25

@netlify
Copy link

netlify bot commented Mar 16, 2026

👷 Deploy request for cyf-launch pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 1246d25

Copy link
Member

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! One suggestion/thought

We should (almost!) always work from a clean copy of main. When you move from one task to the next, do not keep the changes from the previous task. Often in the real world your last PR will be merged to main before you branch for the new task, so you will have the changes included in the second task's PR, but they are not part of the branch, they are there as part of main. When doing these exercises (or in real world scenarios where your previous branch hasn't been merged) it is important to start from a clean checkout of main. You can do this before you start on the second task by using

```plain
git reset --hard origin/main
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a useful "I already made my branch wrong I need to fix it" command, but I read your text above as suggesting this is for creating a new branch?

Do we want to suggest:

git switch --create new-branch main

as a default way to make a new branch, and give the reset command as an "If you already created your branch and need to undo things" command?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Further commit incoming

git switch -c new-branch main
```

which will remove your committed branch and create a new one based on main.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
which will remove your committed branch and create a new one based on main.
which will create a new one based on main, and switch to it.

If you've got random uncommitted changes in your local folder, they will not be removed by the above command. So before you do that command you can clean things up:

```plain
git reset --hard origin/main
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I read this, this risks people resetting their old branch to origin/main rather than "the committed tip of the branch being updated"?

Suggested change
git reset --hard origin/main
git reset --hard HEAD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📋 Backlog

Development

Successfully merging this pull request may close these issues.

2 participants