Recently I was stuck on the process of pushing my work from my local branch to a remote repository so I decided to document it down so that the next time I need to do this, I will just follow these steps and I won't have to worry so much about being stuck. That is actually the beauty of having a blog where you can document what you don't want to forget or currently learning. That being said let's get right into it


I will list the steps below and what it does

- First off, you must have created your own branch off the main branch (if you need tips on how to do this, check my post here)


- So let's say for example your new branch's name is wemis_branch, which is the name I will be using to illustrate this whole process. Once you are done editing or making changes to your new branch and you are ready to push to the remote, go ahead and follow the following steps below.


Step 1:

git branch

- This is to confirm and double check that you are on the right branch that you desire to push to the remote

*wemis_branch

main


Note

From the example above, the asterisk branch shows the branch  that I'm currently working on


Step 2:

Once you have confirmed that you are on the right branch, pull from the origin just to be sure that your branch is up to date (you may not be the only one working on that branch and a couple of changes might have occurred since your last pull)

git pull origin wemis_branch


Step 3:

- Next is a git status, this will show a list of the files that have been modified or changed and are ready to be committed (at this point you can decide if you want to add a specific file or add all the files)

git status


Step 4:

- If you are adding specific files, you have to watch out for the path and ensure that it is written correctly

e.g:-

git add src/components/(this will be the name of the file)

- If you want to add all the files that you have made changes to, use

git add .


Step 5:

- The next step is to commit with a quick note on what changes you made 

git commit -m "this is what I did"


Step 6:

- The last step is to push to the remote branch

git push origin wemis_branch


These are the steps that are required to push from your local branch to a remote branch. Once you have been able to complete all these steps successfully, you can then go to your Github page, search for the specific repository that you are working on and also search for the new branch that you just pushed in.


Once you have confirmed that it has been pushed to the remote, you can then go ahead and send a pull request or just keep working on that branch if you still need to make changes


Yeah, these are the simple steps to push from a local branch to a remote branch on Github. I will be coming here from time to time as well until I fully get a hang of it. That will be all from me today. See you soon.


Food for Thought:- "Experience is the name everyone gives to their mistakes.” ~ Oscar Wilde

HAPPY CODING!!! ❤️



SHARE 0 comments

Add your comment

© Wemi's Coding Board · THEME BY WATDESIGNEXPRESS