Add the file on the specific branch in git

In order to add files in specific branch follow the below instructions :

To create custom branch

git branch branchname

To switch into custom branch

git checkout branchname

To initialize in the custom branch

git init

To add files in the custom branch

git add file name

To commit the changes made in the custom branch

git commit -m "your message"

To make changes in your GitHub repo

git push

Hope you get clear cut idea.

Thank you.


Sometimes when you use

git add fileName

you get this error

The following paths are ignored by one of your .gitignore files: fileName

In order to still add it, go to your .gitignore and comment the line associated with that file adding #,

#fileName

Then you will be able to add, commit, and push.

Tags:

Git

Github