Create a file on your local machine using GitBash and push it to a GitHub repository.

Create a file on your local machine using GitBash and push it to a GitHub repository.
To create a file from your local machine via GitBash and push it to a GitHub repository, follow these steps:
- Open GitBash: Launch GitBash on your local machine.
- Use the
mkdir
command to make a folder. - Use the
cd
command to navigate to the myapp directory. - Use the
git init
command to initialise git on your local repository

5. Create a New File: Use the touch command to create a new file. For example, to create a file named index.html

6. Add Content to the File: Open the file with a text editor (like vi) and add some content.
vi index.html

After adding content, use the command :wq
+ enter to save and exit the editor.
7. Let’s connect the local repository to the GitHub repository using the following command: git remote add origin
<url>
8. Stage the File: Use the git add
command to stage the new file.

9. Commit the Changes: Commit the changes with a descriptive message.

10. Push to GitHub: Push the changes to your GitHub repository.

By following these steps, you will have successfully created a file on your local machine using GitBash and pushed it to your GitHub repository.
The next step is to create a pull request:

The following window pops up:

To resolve the issue of branches having entirely different commit histories, you can use the following commands:
git checkout master
git branch main master -f
git checkout main
git push origin main -f


Greetings! I am Charly, an aspiring DevOps Engineer. Recently, I began the lengthy process of transitioning from Logistics to Technology. Technology has been my passion, having worked in tech support in the past. Welcome to my blog, where I will chronicle my daily learning journey toward becoming a DevOps Engineer.