GIT: Difference between revisions

From AWVVO
Jump to navigationJump to search
Created page with "== Show current branch == <syntaxhighlight lang="bash" line highlight="" copy> @echo off for /f "delims=" %%a in ('git rev-parse --abbrev-ref HEAD') do ( set "current_branch=%%a" ) echo Current branch is: %current_branch% </syntaxhighlight> == Create new branch == <syntaxhighlight lang="bash" line highlight="" copy> git checkout -b newbranch </syntaxhighlight>"
 
Line 8: Line 8:
echo Current branch is: %current_branch%
echo Current branch is: %current_branch%
</syntaxhighlight>
</syntaxhighlight>
To show remote branches in Git, use:
1. List all remote branches:
sh
Kopiëren
Bewerken
git branch -r
2. Show both local and remote branches:
sh
Kopiëren
Bewerken
git branch -a
3. Fetch the latest branches from remote:
sh
Kopiëren
Bewerken
git fetch --all
4. Show detailed info about remote branches:
sh
Kopiëren
Bewerken
git remote show origin


== Create new branch ==
== Create new branch ==

Revision as of 08:43, 12 February 2025

Show current branch

@echo off
for /f "delims=" %%a in ('git rev-parse --abbrev-ref HEAD') do (
    set "current_branch=%%a"
)

echo Current branch is: %current_branch%

To show remote branches in Git, use:

1. List all remote branches: sh Kopiëren Bewerken git branch -r 2. Show both local and remote branches: sh Kopiëren Bewerken git branch -a 3. Fetch the latest branches from remote: sh Kopiëren Bewerken git fetch --all 4. Show detailed info about remote branches: sh Kopiëren Bewerken git remote show origin

Create new branch

git checkout -b newbranch