Branch Structure + GitKraken Tutorial #25
jiwang6
announced in
Tutorials & Tools
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Git Starter Guide
Intended Workflow
Assuming our
mainbranch will contain our live version of FalconNet, we will have the following branch structure:Here, RC stands for "Release Candidate."
The purpose of this structure is to preserve functionality in both the main and develop branches. This is so that FalconNet stays online while we develop and so that other team members may increment on the development snapshot. We increment the develop branch with features and will have a release branch we may iterate and fix before release.
Getting Started
These actions constitute the majority of commands you need to use GitHub individually. In this section, we will not touch upon the actions needed to work effectively as a team.
GitKraken Install
Since the command line may seem daunting for newer coders, we will be using a GUI for VCS. Visit GitKraken's home and click the glowing download button. Run through the install with default options again.
To link your GitHub account to the git client on your computer simply hit the
Log in with GitHubbutton. Enter your credentials and you're set.Clone
Cloning a repository is exactly what it sounds like: it downloads a copy of the repository and its branches to your local machine. On GitKraken, this action can be found in the
Filetab or just by usingCtrl + Nto clone a repo.Add (Staging), Commit, and Push
As we work through our project, we often save it intermittently (sometimes out of anxiety). To "save" our files to Git Kraken, we "stage" these changes in preparation to push. This can be easily on the right-side panel as it often prompts us to stage the changes we want.
Once we're sure of the files we want to change on the remote repository, we will "commit" our changes. This is often done with a "commit message," a short blurb describing what we've changed or iterated upon.
Once we've committed our changes, we may push. Unsurprisingly, this is done with the "Push" button on the top bar of GitKraken.
Working as a Team
This is where the majority of Git's appeal comes from. We can manage many different developers' in-progress features and releases at the same time.
Branch
Branching the repository will copy the repository, allowing you to edit the code while preserving the original state of the repository you branch. We do this so that other people can contribute to the code at the same time as you without waiting for you to finish (this was a major drawback of Microsoft Powerapps). This can be done with the
Branchbutton at the top of GitKraken. Note that we may also branch branches other thanmain.Stash and Pop
Oftentimes, we may want to pause our work on one branch and revert to the last commit. This is done with the
Stashcommand (the button is named the same on GitKraken).To recover the work we've stashed away, we may use the
Popcommand. This we may 'pop' our stash across branches too, though this will most likely result in merge conflicts that we will need to resolve by hand.Checkout
How do we look at other branches we've cloned? This is done with the
checkoutcommand. In GitKraken, we simply double-click on the branch we want to checkout.Merging Two Branches You Own
When you want to combine two branches that you have been working on, simply
mergethem together. This is done on GitKraken by drag-and-dropping two branches on top of each other.Pull Requests: Merging into a Team's Branch
In this team, we would like developers to submit a merge request on GitHub. Push all the branches you've been working on and navigate to the "Pull Requests" tab and click "new pull request". This signals to your leadership that you want to merge your changes into the development branch to be used by other developers. Leadership will then either approve or deny your pull request.
Pull
Should we want to update the local copy of the repository, we simply execute a
pullcommand, done with the Pull button on GitKraken. By default, GitKraken will "fast forward," changing all code in your local repository to the most recent versions online. This will not change your working branch. Alternatively, rebasing will stash all un-committed changes you have.References
General Git Tutorial
GitKraken Tutorial
Beta Was this translation helpful? Give feedback.
All reactions