GitHub

Setup

To set up GitHub for a new project see the Installation section.




Branches - new project features

It is a good practice to create a new branch for each new feature you work on in your Django project. This allows you to work on the feature independently without affecting the main codebase, and also provides a clean way to merge the changes into the main branch once they are ready.

Step 1: create a new branch

git checkout -b new-feature

Step 2: add and test the new feature

Step 3: add commits

git add .
git commit -m "Implemented new feature"

Step 4: push all changes to the 'new-feature' branch on the remote repository

git push -u origin new-feature

Step 5: create a pull request

Step 6: review and merge the pull request

Step 7: update your local main branch

git checkout main
git pull origin main

Step 8: delete the remote new-feature branch on the remote repository

git push origin --delete new-feature

Step 9: delete the remote new-feature branch on the local repository

git branch -d new-feature



Clone a repository from GitHub to a local machine

Copy url: go to the repository on GitHub, click on code, and copy the URL

Clone repository: inside the directory where you want to store your locl copy open terminal and use the following command

git clone _your_repository_url_

Commit & Push:

git add .
git commit -m "my_commit_message"
git push origin main



GitHub Pages

Host a static page on GitHub for free




Useful commands