Throughout this tutorial, we won’t guide you too much on using Git. For all of the code, we recommend using branches and atomic commits, as well as pushing to the remote frequently.
Not sure what to do with Git or GitHub? Check out some of the on-demand courses to learn more!
Let’s create our first commit, and push our project to GitHub .
Create your first commit
git status, and see that all of your files are currently untracked in the working tree.
git add .gitignore. This command stages our first commit using a special file called
.gitignore, which lets us specify the parts of our project that should be pushed to GitHub, and those that should remain just on our machine.
git commit -m "initial commit with gitignore"to craft our first commit.
- Stage the rest of the files, using
git add ..
- Create your commit using
git commit -m "add electron boilerplate files".
Push to GitHub
Create a new repository on GitHub.com. To avoid errors, do not initialize the new repository with
.gitignorefiles. You can add these files after your project has been pushed to GitHub.
- Follow the steps shown in your new project for pushing an existing repository from the command line. See Tell my why if you’d like some extra resources to help you along.
Tell me why
By default, the boilerplate initialized this directory as a Git repository, so we won’t need to do any extra work to get this set up. But we did need to do a little work to get it pushed up to GitHub.com, where we can show off our code to others, and backup our work.
There’s a file in your repository named .gitignore. Git uses this to determine which files and directories to ignore, before you make a commit.
We want to use a
.gitignore file built for Node projects, since Electron is a Node based project. Typically, we would do this manually. Since we used a boilerplate, this is already done. If you’re interested in learning about different
.gitignore files, the github/gitignore repository contains examples for many common programming languages.
More about pushing to GitHub
Repositories can live locally on your machine, but also on a remote like GitHub.com. The steps had you push your repository to GitHub, but if you need some assistance on performing some of the steps we described, you may find the following links helpful: