02:00
SFA team’s training
January 30, 2024
When done, open Git Bash
, type
git config --global user.name "Firstname Lastname"
git config --global user.email "email@adress.org"
N.B. These two lines identify you in the history of a project.
More details on Configuring and customizing GitHub Desktop
Github Desktop
and create a new repository training-git
Create Repository
02:00
README.md
file \(\rightarrow\) README.md is now in Workspace but not in Localgit status
Sur la branche main
Fichiers non suivis:
(utilisez "git add <fichier>..." pour inclure dans ce qui sera validé)
README.md
aucune modification ajoutée à la validation mais des fichiers non suivis sont présents (utilisez "git add" pour les suivre)
git add README.md
and git status
Sur la branche main
Modifications qui seront validées :
(utilisez "git restore --staged <fichier>..." pour désindexer)
nouveau fichier : README.md
git commit -m ”First commit”
[main fde1cd2] First commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README.md
fde1cd2 is a short version of the identifier of the commit
git log
commit fde1cd295a8403756d655ec6d1f2be9eb908f649 (HEAD -> main)
Author: Julien Lebranchu <julien.lebranchu@ird.fr>
Date: Fri Oct 20 14:36:19 2023 +0400
First commit
commit 25681b3e0212f771a4594abc008d5352436a6244
Author: Julien Lebranchu <julien.lebranchu@ird.fr>
Date: Fri Oct 20 14:35:11 2023 +0400
Initial commit
README.md
file from your explorer filehistory
tab.05:00
README.md
file and commit
the changes02:00
Git has the ability to tag specific points in a repository’s history as being important. Typically, people use this functionality to mark release points (v1.0, v2.0 and so on).
Open the README.md
file
Type ## Version v1.0.0
.
Commit the changes
Create a tag v1.0.0
with right click the last commit
02:00
It is possible to tell Git to ignore some files by using a .gitignore
file.
A gitignore file specifies intentionally untracked files that Git should ignore. Files already tracked by Git are not affected.
Example for R
project
output.log
fileGitHub Desktop
.gitignore
file
*.log
.output.log
file no longer appears as Untracked03:00
git checkout v1.0.0
→ move to a tag%%{init: { "theme": "base" }}%% gitGraph commit id: "25681b3" commit id: "fde1cd2" commit id: "9b0dce3" commit id: "017fc9d" tag: "v1.0.0" type: HIGHLIGHT commit id: "fe96d29"
git checkout fde1cd2
→ move to the first commit%%{init: { "theme": "base" }}%% gitGraph commit id: "25681b3" commit id: "fde1cd2" type: HIGHLIGHT commit id: "9b0dce3" commit id: "017fc9d" tag: "v1.0.0" commit id: "fe96d29"
git checkout main (master)
→ move at the latest commit%%{init: { "theme": "base" }}%% gitGraph commit id: "25681b3" commit id: "fde1cd2" commit id: "9b0dce3" commit id: "017fc9d" tag: "v1.0.0" commit id: "fe96d29" type: HIGHLIGHT
N.B. HEAD is a symbolic reference pointing to your location in history
Github Desktop
Publish repository
Repository
> View on GitHub
Repository
02:00
GitHub
, add x = 1
at the end of the README.md
file.README.md
and add x = 2
.Github Desktop
README.md
03:00
This is due to a diverging history that cannot be solved automatically by Git.
origin/main
corresponding to the version on the remote server
%%{init: { "theme": "base" }}%% gitGraph commit id: "25681b3" commit id: "fde1cd2" commit id: "9b0dce3" commit id: "017fc9d" tag: "v1.0.0" commit id: "fe96d29" branch origin/main commit id: "4ba5ab5" checkout main commit id: "5af862d"
If we open the README.md
file, you should have
## Version v1.0.0.
<<<<<<< HEAD
x = 2
=======
x = 1
>>>>>>> 4ba5ab5f6ba79f7ac53d6bcf7ffc7e883ab469e2
N.B. These are conflicts markers.
Git doesn’t know whether to chose x = 1
or x = 2
. This is your job!!
README.md
and replace the 5 lines below by x = 3.<<<<<<< HEAD
x = 2
=======
x = 1
>>>>>>> 4ba5ab5f6ba79f7ac53d6bcf7ffc7e883ab469e2
02:00
%%{init: { "theme": "base" }}%% gitGraph commit id: "25681b3" commit id: "fde1cd2" commit id: "9b0dce3" commit id: "017fc9d" tag: "v1.0.0" commit id: "fe96d29" branch origin/main commit id: "4ba5ab5" checkout main commit id: "5af862d" merge origin/main commit id: "aad87f1"
Write together an awesome book : THE BEST BOOK
Repos : fuzzy-octo-quarto-book
Each one will participate to write a chapter.
Github Desktop
fuzzy-octo-quarto-book
, URL : https://github.com/JulienLebranchu/fuzzy-octo-quarto-book
develop
develop
with your section and your lastname, ie it-gabriel
05:00
it
or stats
resources.qmd
file_quarto.yml
chapters:
- ...
- part: stats.qmd
chapters:
- stats/content.qmd
- stats/XXX.qmd
- part: it.qmd
chapters:
- it/content.qmd
- it/XXX.qmd
05:00
index
local
02:00
We need to link RStudio and GitHub to work togheter without enter the identifier/password each time.