Run the following commands to achieve that but make sure you spend two (3) minutes and read the entire blog post for very important explanations and other information. We assume that we have a directory called champions.
cd champions (to be on the champions directory which is the directory you are pushing from) .
git status (to confirm you are on the right directory you want to push from).
git add –A (to stage all your changes to be committed).
git commit –m “Add brief message to describe the push” (to commit your changes to GitHub).
git pull origin main (To check if your directory/branch is up to date).
git push origin champions (to push your changes to GitHub)
**If **you are new to programming, it is normal to feel overwhelmed by the many new terminologies and commands you must live with for the rest of your working life, especially if your goal is to become a software developer or a Software Engineer.
I must say that if other people have mastered these terminologies and commands. You can master them too.
It is a fact that everything you set out to do or learn for the first time can feel very challenging. One thing that is worth remembering when faced with challenges while learning a new skill is; “the people you view in the field as professionals and experts were once like you. They, also, once or twice felt intimidated when they were just starting out like you”. Go on then to encourage yourself and say to yourself; “if others have started it before me and went on to become experts/professionals, I can also start it, attach seriousness to it and one day, I will be viewed by those behind me as an expert/professional.
What is important is that instead of feeling constantly overwhelmed and stressed about the many information you had to comprehend in a field you are not familiar with, try to find strategies/techniques that can help you to adapt quickly into the new environment.
The focus of this blog post is to help you understand the Git Flow process in just 5 minutes.
The Git Flow process is the various processes / commands you run in the terminal when you are pushing a file from your local machine to GitHub.
Before you start to run your commands, make sure you are on the right directory from where you want to push to GitHub.
You can check the directory you are on by running the cd command in your terminal.
In this blog post, let us assume that we have a directory called champions and we want to push changes we have made in this directory on our local machine to GitHub.
To check if we are on the champions directory, we will run the command, cd champions.
Next, run git status command in the terminal to confirm if you have successfully navigated to the champions directory with your first command.
If you notice that you are on the champions directory it is now time to start pushing your changes to GitHub.
Next type the command git add -A in the command line/terminal to stage your changes ready to commit.
Next type the command git commit -m “champions” to commit your changes to the repository on GitHub.
Next make sure your current branch is up to date before you proceed to open a pull request. Check this by typing the command git pull origin main in the command line.
The output from the git pull origin main command should read; “Already up to date” which is a confirmation that your current branch is up to date.
After you have confirmed that your current branch is up to date, it is now time to do the final step in the Git Flow process that will push your change to GitHub.
To do that type the command git push origin champions.
After this command, a pull request will be created on GitHub. Proceed to GitHub to complete the pull request.
NOTE:
Now you must make sure that your GitHub is in sync with your local machine so run the following commands to achieve that and to return to the main directory of your local machine.
git checkout main
git pull origin main.
USEFUL LINK
https://coding-boot-camp.github.io/full-stack/git/getting-started-with-git
Top comments (0)