Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
:: ----------------------------------------------------------------------------------------------------------
:: >>> SCE Laplace - Service Commun d'Electronique du Laplace <<<
:: ----------------------------------------------------------------------------------------------------------
:: Laboratoire plasma et conversion d’énergie - UMR5213
:: http://www.laplace.univ-tlse.fr/
:: © 2022 Laplace - CNRS/INPT/UPS
:: Créer le 2022-10-02, dernière mise à jour le 2022-10-03
:: par Arnauld Biganzoli <arnauld.biganzoli@laplace.univ-tlse.fr>
::
:: Description :
:: Fichier batch, scipt Windows pour mettre à jour votre repository Git et nettoyer les branches locales et remotes.
:: Rebase sur la branche main par defaut
@REM ----------------------------------------------------------------------------------------------------------
@REM Préparation de la fenêtre cmd
@REM ----------------------------------------------------------------------------------------------------------
@echo off
cls
@REM Définir le titre affiché dans la fenêtre de la console.
title MAJ des branches du repository
@REM Definition des variables en local
setlocal EnableExtensions EnableDelayedExpansion
if exist .git (
echo Mise a jour de vos branches
echo ---------------------------
echo.
@REM git fetch origin --prune && git pull
git fetch origin --prune
git merge
git branch --all --verbose
echo.
@REM On regarde sur quelle branche on est et on revient sur main
set current_branch=
for /F "delims=" %%n in ('git branch --show-current') do set "current_branch=%%n"
@REM echo Switch sur la branche courante main
if "%current_branch%"=="main" (
echo Verification de la branche courante, on est bien sur main
) else if "%current_branch%"=="master" (
echo Verification de la branche courante, on est sur master au lieu de main
) else (
echo Basculement de la branche %current_branch% vers main
git switch main
)
echo.
set current_path=%~dp0
echo Vous etes ici !current_path!xargs.cmd
if exist xargs.cmd (
git branch --merged | xargs git branch -d
) else (
echo Le fichier "xargs" ne semble pas present dans ce repository
)
) else (
echo Vous n'etes pas a la racine d'un repository.
)
echo.
pause
endlocal
@REM End of batch program.
exit