Guillaume Gay, CENTURI multi-engineering
Getting started
Git as an archive
How to revert mistakes
Backing up to github
Branches and forks
pull requests
Issues and bug reports
introduction to Continuous Integration
Linux: sudo apt install git
Mac OS X: git-scm.com/download/mac
or brew install git
In a terminal (“git bash” on Windows)
Documents/GitTuto
)cd
to that directory:You can do this on an existing directory
The
.git
directory contains all git needs to track your project
!! .git
might contain lots of small files
!! Delete .git
→ lose history
You can move the whole directory (with the .git
subdir.)
status
To know what is going on at any time, type:
add
README.md
Now git knows about your file
commit
Git registered your file
diff
Edit README.md (add some text) and
You can see there are untracked changes
log
log
: what happened before now.gitignore
tmp_file.txt
.gitignore
and write tmp_*
in it.Only .gitignore is listed as untracked
It’s good to have a direct read of the state of your code (in your editor or terminal)
There are two commands depending on your git freshness
Those undo changes made since latest commit
You can restore older versions of the file.
For exemple to restore a file at a certain commit, you can reference this commit by its hash:
You can find a commit’s hash with git log
There are plenty of more powerfull things you can do, but I don’t know / need them!
Create an account
Manage SSH
git communicates with public / private keys. To make it easier, we register a key on our github account.
On github, go to settings > SSH and GPG Keys > New SSH key
Copy the content of .ssh/id_rsa.pub
there.
remote add
Create a new (empty) “GitTuto” repository on github
Copy the repo URL
Declare it as a remote
push
pull
git pull
git log
clone
branches are cheap, use them!
Do not hesitate to report problems
Be polite etc.
Use issues to discuss and track your problems
What’s a minimal reproducible example?
Automates tests
No more ‘but it works on my machine :/’
Can be tricky to setup
github.com/centuri-engineering/git_tuto