Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working with branches documentation #181

Merged
merged 29 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
960cda8
initial branches docs
allyhawkins Mar 13, 2024
faa9c65
small edits and add to yml
allyhawkins Mar 13, 2024
e5dd6c6
one header down
allyhawkins Mar 13, 2024
a692fab
other contributors rather than others
allyhawkins Mar 13, 2024
7bdb64b
Merge branch 'main' into allyhawkins/working-with-branches
allyhawkins Mar 14, 2024
dbb96fd
add repo to dictionary
allyhawkins Mar 14, 2024
36ec514
fix spelling
allyhawkins Mar 14, 2024
0be704f
Merge remote-tracking branch 'origin/main' into allyhawkins/working-w…
allyhawkins Mar 14, 2024
01a8a65
Merge branch 'main' into allyhawkins/working-with-branches
allyhawkins Mar 14, 2024
4d271cb
reorganize based on new IA
allyhawkins Mar 14, 2024
92e3460
make image < 1200 px
allyhawkins Mar 14, 2024
643a93a
make sure yml file has new IA
allyhawkins Mar 14, 2024
2a31a87
use the proper path
allyhawkins Mar 14, 2024
31187d9
Apply suggestions from code review
allyhawkins Mar 15, 2024
5948823
reorganize branches
allyhawkins Mar 15, 2024
cc680b4
update naming branch screenshot
allyhawkins Mar 15, 2024
a955c31
Merge branch 'main' into allyhawkins/working-with-branches
allyhawkins Mar 15, 2024
1d8af57
Every time is two words
allyhawkins Mar 15, 2024
92c7a77
Merge branch 'main' into allyhawkins/working-with-branches
allyhawkins Mar 15, 2024
bb7eeb2
Apply suggestions from code review
allyhawkins Mar 15, 2024
fd4fd5d
remove gitkeep
allyhawkins Mar 15, 2024
8bf5f8d
some more rewording
allyhawkins Mar 15, 2024
1366a9b
don't use prs
allyhawkins Mar 15, 2024
1316fdf
add an arrow
allyhawkins Mar 15, 2024
c9b4099
Apply suggestions from code review
allyhawkins Mar 18, 2024
aed9467
Merge remote-tracking branch 'origin/main' into allyhawkins/working-w…
allyhawkins Mar 18, 2024
b893f67
add intro, include upstream instructions, and update screenshots
allyhawkins Mar 18, 2024
082efe0
fix spacing and make arrow thickness bigger
allyhawkins Mar 18, 2024
96a1b03
remove spaces
allyhawkins Mar 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/components/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ precommit
README
redistribution
renv
repo
reproducibility
RStudio
Rtools
Expand Down

This file was deleted.

Copy link
Member

Choose a reason for hiding this comment

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

you can delete this if you want

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Working with branches

## What is a branch?

A branch in GitHub refers to an isolated copy of the repository contents.
For example, the `main` branch of the `OpenScPCA-analysis` repository contains the main copy of all items in the repository.

!!! note
allyhawkins marked this conversation as resolved.
Show resolved Hide resolved
For more details on branches, see [GitHub's documentation describing branches](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches) and [this tutorial on creating branches with GitKraken](https://www.gitkraken.com/learn/git/problems/create-git-branch).


## What is a feature branch?

Instead of directly making code changes in the `main` branch, we write code in a _feature branch_ created off of the `main` branch.
A feature branch contains a copy of in an isolated space.
allyhawkins marked this conversation as resolved.
Show resolved Hide resolved
By using feature branch, you can make code changes without affecting the code in the `main` branch or interfering with other contributors as they make changes.
allyhawkins marked this conversation as resolved.
Show resolved Hide resolved

## When should you use a feature branch?
allyhawkins marked this conversation as resolved.
Show resolved Hide resolved

Every time you make a new addition or modify existing code, you will want to create a _new_ feature branch.
allyhawkins marked this conversation as resolved.
Show resolved Hide resolved
Every pull request should contain changes made in a _single_ feature branch.
allyhawkins marked this conversation as resolved.
Show resolved Hide resolved

## Overview of working with branches in OpenScPCA
Copy link
Member

Choose a reason for hiding this comment

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

I think we might want to make this the first section? If people are familiar with Git, they might want this information first. If they are not, we can direct them to keep reading.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure about this - I think for advanced users I'd rather they just scroll a little (this is one reason to keep nested headers above, makes this section a little more obvious I think), but for beginners it would be overwhelming to see this list before having the "what are branches and why" context. Basically I'm less concerned with advanced contributors vs beginners, and I think it's best to structure docs based around beginners' needs.

Copy link
Member

Choose a reason for hiding this comment

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

Part of my reasoning is that this also is the why for this whole page. I would make this header first, and add "We use branches in OpenScPCA because..." before the bulleted list.

Copy link
Member Author

Choose a reason for hiding this comment

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

Moving this section entirely broke the flow to me and I wasn't a fan. So I came up with a compromise and included a brief "why do we use branches in OpenScPCA" as the intro before any of the sections. Then you can read on for more details. You can see this update in b893f67.


- When you are working on your own analyses or proposing a change to the main code base, we ask that you first fork the repository and then create a feature branch from the `main` branch of your fork.
allyhawkins marked this conversation as resolved.
Show resolved Hide resolved
- Haven't forked yet? Please see [Forking the repo](STUB-LINK).
allyhawkins marked this conversation as resolved.
Show resolved Hide resolved
- You should then incorporate or add any changes that you make to that feature branch (see [Making commits](STUB-LINK)).
allyhawkins marked this conversation as resolved.
Show resolved Hide resolved
- Then create and file a pull request to the `main` branch of `OpenScPCA-analysis` to request to incorporate your additions into the main code base (see [Creating pull requests](STUB-LINK)).
allyhawkins marked this conversation as resolved.
Show resolved Hide resolved

## Creating a feature branch in GitKraken

Follow these steps to create your feature branch:

1.Open the GitKraken GUI interface and make sure you are on the `main` branch of your fork of `OpenScPCA-analysis`.
allyhawkins marked this conversation as resolved.
Show resolved Hide resolved
You can do this by checking the `main` box listed under the `Local` menu.

<figure markdown="span">
![Click button to checkout main](../../img/working-with-branches-1.png){width="600"}
</figure>
sjspielman marked this conversation as resolved.
Show resolved Hide resolved

2.Create and checkout a new branch by right-clicking on the `main` branch and selecting `Create branch here`.
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
2.Create and checkout a new branch by right-clicking on the `main` branch and selecting `Create branch here`.
2. Create and checkout a new branch by right-clicking on the `main` branch and selecting `Create branch here`.

Copy link
Member

Choose a reason for hiding this comment

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

Let's get a little more specific - you can either do this in the local menu, or in the graph. Which do we recommend? Would an arrow help?


<figure markdown="span">
![Create branch](../../img/working-with-branches-2.png){width="600"}
</figure>

3.You will then be prompted to name your branch.
Copy link
Member

Choose a reason for hiding this comment

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

space!

Suggested change
3.You will then be prompted to name your branch.
3. You will then be prompted to name your branch.

Copy link
Member Author

Choose a reason for hiding this comment

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

Just noting that the only way that I've gotten the numbering to work correctly is to actually not use any spaces. It should be correct now and I double checked on the build.

We encourage users to name their branch using their GitHub username followed by a description of what changes will be included in the branch.
For example, if you are adding an analysis to add cell type annotations to Ewing sarcoma samples, you might name your branch `username/celltype-ewings`.

<figure markdown="span">
![Name branch](../../img/working-with-branches-3.png){width="600"}
</figure>

!!! note
allyhawkins marked this conversation as resolved.
Show resolved Hide resolved
Pro tips for creating branch names:
allyhawkins marked this conversation as resolved.
Show resolved Hide resolved

- Branch names should always be unique, so don't reuse old branch names!
- Names should not contain any special symbols besides `_` and `-`.
- It can be extra helpful to include the issue number in your branch name, e.g., `username/42-celltype-ewings`.


You have now successfully created a new branch and are free to make changes to the code and continue with your analysis!
allyhawkins marked this conversation as resolved.
Show resolved Hide resolved
Binary file added docs/img/working-with-branches-1.png
Copy link
Member

Choose a reason for hiding this comment

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

can we actually make this arrow thicker? It's very small compared to the rest of the image

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/working-with-branches-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/working-with-branches-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ nav:
- contributing-to-analyses/index.md
- Doing an analysis:
- contributing-to-analyses/doing-analyses/index.md
- Working with Git: # Creating branches, adding commits, all git interactions
- contributing-to-analyses/doing-analyses/working-with-git/index.md
- Working with Git: # Creating branches, adding commits, all git interactions
- contributing-to-analyses/working-with-git/working-with-branches.md
allyhawkins marked this conversation as resolved.
Show resolved Hide resolved
- Software platforms: # LSfR, AWS, Docker, etc
- software-platforms/index.md
- Getting Help and FAQ: # troubleshooting and FAQ
Expand Down