Tinus EngOps Wiki

Logo

OpsaC - Operating as PowerShell code

Links

Home

PowerShell Blog

PowerShell Index

PowerShell Search

Additional Websites

View my GitHub Profile

View my GitHub Gists

View Tinus IT Wiki

View my Photo Website

Git Basics

published: February 6, 2021 author: Tinu tags: PowerShell categories: GitLab


Table of Contents

Git offline Installation

VSCode integrates Git version control. Download and install Git.

Download Source

Git Configuration

Git global settings are saved in “$($env:USERPROFILE).gitconfig” while local settings are saved in the root folder of the respective project.

The global settings can be set from “$($env:USERPROFILE).gitconfig” to another path by setting the environment variable HOME to the desired path (Example: $env:home = ‘D:\github’).

List global settings

git config --global -l

List system settings

git config --system -l

these settings can only be changed with admin rights.

Define identity with name and email

git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
[credential "https://github.com"]
     username = 'Tinu'

[credential]
     helper = wincred

Proxy

[http "https://gitlab.company.int"]
	proxy = http://proxy.company.int:8080/

[credential]
	helper = wincred

[credential "https://gitlab.company.int"]
     username = 'Tinu'

Work with Git

Git

Git clone

cd <your local working git folder>
git clone <git-url>

Update local repository

cd <your local working git project>
git pull

Add and upload changes

git add . | <file to add>
git commit -m "Commit message"
git push

List all local branches

git branch

Create new branch

git checkout -b <new_branch>

Remove branch

$branch_to_delete = 'new_branch'
git checkout master
git push origin --delete $branch_to_delete
git branch -D $branch_to_delete

See also

git –fast-version-control.


← Previous Post [ Top ] Copyright © 2024 by tinuwalther [ Blog ] Next Post →