Summary: In this exercise we will create a new repository in github, as well as open a pull request and merge to the main branch.
- Go to GitHub and login
- Click on the New repository button, choose the name of your new repository (in our case it's going to be
repo-name) and click create. - Go into your terminal and write the command
git init repo-nameto create the local repository. - Get inside the folder with the command
cd repo_name - Create a new file with the command
touch repo_file.txt - Stage that file
git add file_name - Commit the changes
git commit -m "first commit" - Link the remote repository that you created with this one by running the command
git remote add origin https://....gitwhere the address in https:// is the address of your github repository. - Push the changes to the remote repository by running
push -u origin master - With the command
git remote -vwe can see the links to the remore repositories. - Create a new branch called experimental with the command
git branch experimental - Do some changes to the repo_file.txt, stage and commit them
git commit -am "some changes" - Run the command
push -u origin experimentalto push everything from this branch remotely. - Go into the repository to see the changes we made.
- Check the two branches.
- Open a pull request from experimental to master.
- Squash and merge the changes
- Go back into your terminal and run the command
git pullto update your local repository.