GIT: Difference between revisions

From AWVVO
Jump to navigationJump to search
Line 2: Line 2:
<syntaxhighlight lang="bash" copy line highlight="0">
<syntaxhighlight lang="bash" copy line highlight="0">
git clone --branch BRANCH_NAME https://ghp_TOKEN@github.com/USERNAME/REPO_NAME.git
git clone --branch BRANCH_NAME https://ghp_TOKEN@github.com/USERNAME/REPO_NAME.git
</syntaxhighlight>
== Show local changes ==
<syntaxhighlight lang="bash" copy line highlight="0">
git diff
</syntaxhighlight>
</syntaxhighlight>



Revision as of 13:30, 20 March 2025

Git clone using classic token

git clone --branch BRANCH_NAME https://ghp_TOKEN@github.com/USERNAME/REPO_NAME.git

Show local changes

git diff

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


Clone repo using token

git clone https://ghp_ABC123yourtoken@github.com/yourusername/your-repo.git