.git
push
code from your computer to a a hosted environment (i.e.
GitHub, GitLab)fetch
or pull
code from that hosted environment to
your computer
apt-get install git
pacman -S git
yum install git
Now that we have git installed, we need to run a few commands to get it set-up.
git config --global user.name "Your Username Here"
git config --global user.email "your@email.here"
By default, git will use your default test editor for your commits. If you'd like to change it, this is the command to run.
git config --global core.editor path_variable_for_editor_here
In general, something like nano, notepad++, or vim is recommended.
git init
git status
Awesome! Git is now tracking this folder. Let's talk about commits now.
git commit
Committing a file is us telling git that we want to save the current code as a point in history.
git add .
To add specific files:
git add hello_world.py
git commit
For short and sweet commits you can do:
git commit -m "Title" -m "Description"
VSCode and PyCharm have git interfaces if you'd rather not use the terminal.
git commit
?Committing a file tells git we want to save the current code as a snapshot, a point in history we can revisit if we have to.
What happens when we make a second commit?
print("hello world")
print("hello Python Discord!")
git add .
git commit -m "Add another hello print"
git branch
work?A branch is a different version of your codebase where you can have different commits and a different commit history.
Branches allow you to work on different versions of your code and switch between them easily.
You can merge branches together and git will do the behind-the-scenes work of fitting together the different commits into one cohesive history.
Branches are used to separate production-ready code, often called the main or master branch, from developmental, unstable code.
New branches are often made when implementing an additional feature, or fixing a bug.
Git - version control; software responsible for tracking changes to your files
Handles committing, merging, branches, push, and pulling
GitHub - a git forge; online service to store git repositories
Has additional features such as:
Using the SSH protocol, you can connect and authenticate to remote servers and services. With SSH keys, you can connect GitHub without supplying your username and password each visit.
Setup
Further Reading
Are SSH tokens just a bit too much for you to deal with? You can use GitHub's Personal Access Tokens.
See this guide: --link goes here--
You know how to work with git locally and you have GitHub setup. Let's work with them together.
push
our local repository to GitHub, that way others can access itgit push args here
git repo add args or whatever here
Someone made changes to the repository, let's pull
down those changes so we can view it locally.
push
it to GitHubpull
down the changes to our local machinegit pull args here
Forking creates your own copy of a repository, of which you are in control.
Pull requests can be opened to apply changes to the original repository.
GitHub Actions automates the menial tasks, like running tests and publishing packages.
Let's give a nice and quick rundown of what a good commit is and all the components
Maybe even a "dissection" of an example commit, pointing out all the pieces
Have Seb write something
git help [command]