Git Branches and GitHub Project Management
REU Site: Applying Data Science on Energy-efficient Cluster Systems and Applications
Training Material
Git - Branches
Branches are different versions of a repository at one time.
Default Branch: main (old version use master)
Create a new branch: making a copy of main as it was at that point in time.
If someone else made changes to the main branch while you were working on your branch, you could pull in those updates.
Image Source: https://guides.github.com/activities/hello-world/
More on Git Branch: https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging
Git - Examples of Using Branches
A project with two major features
If bugs exist in the test version, go back to the feature development version to fix them.
feature1_dev
feature2_dev
feature1_test
feature2_test
merge
merge
release_candidate
main
merge
merge
merge
new branch
version released
new branch
regression test
new branch
merge
Git - Examples of Using Branches (2)
Create branches with features have no dependencies
feature1_dev
feature2_dev
merge
main
merge
merge
merge
version released
version released
merge
version released
merge test
merge test
Git - Examples of Using Branches (3)
A successful git branch model
Supporting branches
Git Commands for Branch
Git - Branching and Merging Commands
Source: https://git-scm.com/docs
Git - Branching and Merging Commands (cont.)
Source: https://git-scm.com/docs
Project manager to perform the merge back to master
Git - Branching and Merging Commands (cont.)
Add a new line in the test_branch.txt.
<<<<<<< HEAD
Inset a new line from the Document folder.
=======
Insert a new line from the Desktop folder.
>>>>>>> 18f5d421d6e7a7c7f49d72ff04ab302a18a60b2d
Make sure that you have resolved all the conflicts in the file(s). You could search for “=======” in the conflict file(s).
Test if your program works after solving the merge conflicts. Then push your changes to the remote branch.
Activities: group practice
Be very careful if you need to merge back to the main. You may want to first check if there are any updates on the origin/main, merge it to your dev branch, and test and merge it back. Ask a Git expert in your group or your project manager.
GitHub - Create a Branch and Pull Request
GitHub - Public v.s. Private Repository
Once public, some data had been shared even it was set to be private
GitHub - Remove Sensitive Data
GitHub - Release a project
GitHub Project Manage
Create an issue to suggest a new idea or track a bug. Then organize and assign tasks to your team. And don’t spare any attachments—issues support most image and file types.
GitHub Project Manage (cont.)
2. Link issues and pull requests
When you link a pull request to the issue the pull request addresses, collaborators can see that someone is working on the issue. When you merge a linked pull request into the default branch of a repository, its linked issue is automatically closed.
You can link a pull request to an issue by using a supported keyword in the pull request's description.
The syntax for closing keywords depends on whether the issue is in the same repository as the pull request.
close | fix | resolve |
closes | fixes | resolves |
closed | fixed | resolved |
GitHub Project Manage (cont.)
3. See your work take shape with Projects
GitHub README file
References
Git
Github
REU Site: Applying Data Science on Energy-efficient Cluster Systems and Applications