Update 03-01-2024
This commit is contained in:
@@ -775,6 +775,96 @@ https://blog.zenika.com/2017/01/24/pull-request-demystifie/
|
||||
|
||||
|
||||
|
||||
### Connaitre la version courante:
|
||||
|
||||
```bash
|
||||
$ git show
|
||||
commit a3f86d08322bc3ef14157ced679907b2b8ec27ee (HEAD -> master, tag: debian/1.0.12-5, origin/master, origin/HEAD)
|
||||
Author: James Valleroy <jvalleroy@mailbox.org>
|
||||
Date: Sat Jan 8 21:31:13 2022 -0500
|
||||
|
||||
Release v1.0.12-5 to unstable
|
||||
|
||||
$ git show | grep -m 1 "Release"
|
||||
Release v1.0.12-5 to unstable
|
||||
|
||||
|
||||
$ git show
|
||||
commit a749e724fbeb5cd1b13272a2784c7c2945dc138a (grafted, HEAD -> master, origin/master)
|
||||
Author: Jay Salvat <jay@jaysalvat.com>
|
||||
Date: Sat Jan 30 11:09:55 2021 +0100
|
||||
|
||||
Build v2.5.4
|
||||
|
||||
$ git show | grep -m 1 "Build" | awk -F"v" '{print $2}'
|
||||
2.5.4
|
||||
|
||||
$ ssh -q -t funnymac@ftp.cluster011.ovh.net "cd www/photoblog/js/vegas && git show | grep -m 1 \"Build\"" | awk -F"v" '{print $2}' | sed 's/.$//'
|
||||
2.5.4
|
||||
```
|
||||
|
||||
```bash
|
||||
$ git log
|
||||
commit a749e724fbeb5cd1b13272a2784c7c2945dc138a (grafted, HEAD -> master, origin/master)
|
||||
Author: Jay Salvat <jay@jaysalvat.com>
|
||||
Date: Sat Jan 30 11:09:55 2021 +0100
|
||||
|
||||
Build v2.5.4
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Savoir si mise-à-jour est dispo:
|
||||
|
||||
```bash
|
||||
$ git remote show origin | grep $(git rev-parse --abbrev-ref HEAD) | tail -1
|
||||
master pousse vers master (à jour)
|
||||
```
|
||||
|
||||
!!! warning "Si on a un repo partiel, **git remote** recontruit le repo git"
|
||||
|
||||
```bash
|
||||
$ git remote -v update
|
||||
POST git-upload-pack (188 bytes)
|
||||
Depuis https://salsa.debian.org/php-team/pear/php-gettext
|
||||
= [à jour] master -> origin/master
|
||||
= [à jour] pristine-tar -> origin/pristine-tar
|
||||
= [à jour] upstream -> origin/upstream
|
||||
```
|
||||
|
||||
```bash
|
||||
$ git remote update
|
||||
|
||||
$ git status -uno
|
||||
Sur la branche master
|
||||
Votre branche est à jour avec 'origin/master'.
|
||||
|
||||
rien à valider (utilisez -u pour afficher les fichiers non suivis)
|
||||
```
|
||||
|
||||
```bash
|
||||
$ git remote update
|
||||
|
||||
$git show-branch origin/master
|
||||
[origin/master] Release v1.0.12-6 to unstable
|
||||
```
|
||||
|
||||
```bash
|
||||
local_commit=$(git rev-list --all -n1)
|
||||
remote_commit=$(git ls-remote origin master)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```bash
|
||||
$ git ls-remote origin master
|
||||
7abeca2bd7df910ac546e06a62c128a40f56874a refs/heads/master
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### => [Session de travail avec git](git-session.md) <=
|
||||
|
||||
#### => [Synchroniser 2 dépôts (--bare)](sync-repo.md) <=
|
||||
|
||||
88
docs/Divers/git/github.md
Normal file
88
docs/Divers/git/github.md
Normal file
@@ -0,0 +1,88 @@
|
||||
# GitHub
|
||||
|
||||
|
||||
|
||||
### Cloner juste un sous-dossier d'un repo:
|
||||
|
||||
```bash
|
||||
~/Documents $ git init vegas
|
||||
|
||||
~/Documents
|
||||
$ cd vegas
|
||||
drwxr-xr-x@ - bruno staff 17 nov 16:14 17 nov 16:14 -I .git/
|
||||
|
||||
~/Documents/vegas master
|
||||
$ git remote add origin https://github.com/jaysalvat/vegas.git
|
||||
|
||||
~/Documents/vegas master
|
||||
$ git config core.sparsecheckout true
|
||||
|
||||
~/Documents/vegas master
|
||||
$ echo "dist/*" >> .git/info/sparse-checkout
|
||||
|
||||
~/Documents/vegas master
|
||||
$ git pull --depth=1 origin master
|
||||
remote: Enumerating objects: 56, done.
|
||||
remote: Counting objects: 100% (56/56), done.
|
||||
remote: Compressing objects: 100% (41/41), done.
|
||||
remote: Total 56 (delta 16), reused 39 (delta 14), pack-reused 0
|
||||
Dépaquetage des objets: 100% (56/56), 89.72 Kio | 1.91 Mio/s, fait.
|
||||
Depuis https://github.com/jaysalvat/vegas
|
||||
* branch master -> FETCH_HEAD
|
||||
* [nouvelle branche] master -> origin/master
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Récupérer un sous-dossier d'un repo:
|
||||
|
||||
```bash
|
||||
$ svn export --force https://github.com/jaysalvat/vegas/trunk/dist
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Télécharger la dernière release:
|
||||
|
||||
```bash
|
||||
$ wget -O vegas.zip https://github.com/jaysalvat/vegas/archive/refs/heads/master.zip
|
||||
```
|
||||
|
||||
|
||||
|
||||
Dernier tag d'un repo:
|
||||
|
||||
```bash
|
||||
$ curl -s 'https://github.com/go-gitea/gitea/tags/'|grep -Eo "$Version v[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}"|sort -r|head -n1
|
||||
v1.22.0
|
||||
|
||||
$ curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/go-gitea/gitea/tags | jq -r '.[0].name'
|
||||
v1.22.0-dev
|
||||
|
||||
```
|
||||
|
||||
Récupérer tous les tags d'un repo:
|
||||
|
||||
```bash
|
||||
$ curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/go-gitea/gitea/tags | jq -r '.'
|
||||
[
|
||||
{
|
||||
"name": "v1.22.0-dev",
|
||||
"zipball_url": "https://api.github.com/repos/go-gitea/gitea/zipball/refs/tags/v1.22.0-dev",
|
||||
"tarball_url": "https://api.github.com/repos/go-gitea/gitea/tarball/refs/tags/v1.22.0-dev",
|
||||
"commit": {
|
||||
"sha": "d7f73a1334ab7a97d4e055b7c58cdd9ac303f77a",
|
||||
"url": "https://api.github.com/repos/go-gitea/gitea/commits/d7f73a1334ab7a97d4e055b7c58cdd9ac303f77a"
|
||||
},
|
||||
"node_id": "MDM6UmVmNzI0OTU1Nzk6cmVmcy90YWdzL3YxLjIyLjAtZGV2"
|
||||
},
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
```
|
||||
$ curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/go-gitea/gitea/releases/latest | jq -r '.'
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user