Directions to add new file to branch

Hi. I’m a newbie to Github. I have taken some code from PD, saved it as initial master. now I want to give it a different name aligned with the longer term project intention and split it into 3 smaller files.

So I checked in the original file with zero content, broke up the content with notepad++, now I want to upload the 3 new files into a new branch…

Hi there 👋

There are several ways to add files to a branch, may I ask what you’re using to add and commit files with? command-line, GitHub desktop, or something else? :slightly_smiling_face:

GitHub website currently. The desktop does not seem to be 1:1 with the “Hello World” tutorial

I’m suspecting that might be because you changed files on your GitHub but didn’t pull down the changes locally, git has a pull/push relationship between repository locations.

So if you make changes locally, you will want to push them to a remote location, and if you’ve made changes on your GitHub - now I’m talking website not desktop application, you will want to pull those changes down locally, it’s good practice to always pull before you start modifying files so you can ensure your local version has the latest version.

But so add files to a branch on GitHub, the website, you simply need to click Add file button and Create new file, and at the bottom of the page just above the green Commit new file button you will see a little checkbox that says Create a new branch for this commit and start a pull request, check that and you’ll get an input where you can name your new branch, to save the file click the green Propose new file - the file will be added to your new branch and you will be taken to the Open a pull request page, now, don’t worry if you don’t know what a pull request is, you can simply click of the page back to your repository.

When your back on your repository page you can select your new branch via the drop-down menu, or add /branches to your repo URL.

Then to keep adding files to that branch you simple make sure the branch is selected the next you want to add a file.

Hope that explains it. :slightly_smiling_face: