OpsaC - Operating as PowerShell code
published: February 6, 2021 author: Tinu tags: PowerShell categories: GitLab
VSCode integrates Git version control. Download and install Git.
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').
git config --global -l
git config --system -l
these settings can only be changed with admin rights.
Show all settings of all gitconfig-files:
git config --list --show-origin
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
gitconfig:
[user]
name = John Doe
email = johndoe@example.com
gitconfig:
[http "https://gitlab.company.int"]
proxy = http://proxy.company.int:8080/
[credential]
helper = wincred
[credential "https://gitlab.company.int"]
username = 'Tinu'
If you need Proxy credentials then you can create a file .netrc and putting the settings in to this file.
netrc:
machine <Fully qualified name of the proxy>
login <login user>
password <password>
gitconfig:
[http]
sslverify = true
sslBackend = schannel
proxy = http://proxy.company.int:8080/
[user]
name = John Doe
email = johndoe@example.com
[credential "https://gitlab.company.int"]
username = 'tinu'
Working with a remote Repository like GitLab.

The first thing that you should do, is to clone the remote Repository to a locale Repository.
git clone <git-url>
If you have a locale Repository, then you also have a local working area (WorkingDir).
In this directory, you make your changes like add folders/files, update/remove folders/files.
But before you make a change, please create a new branch.
git checkout -b <new_branch>
Make your changes in the new branch and add the changes to the local staging area.
git add <file to add> # or git add . to stage all changes
Commit your changes to your local Repository.
git commit -m "Commit message"
If all changes are commited, then push the branch to the remote Repository.
git push --set-upstream origin <new_branch>
In GitLab you have to create a Merge Request to merge the new_branch in to the main branch and merge it.
After the Merge ist completed, you should update your local Repository.
Switch to the main branch:
git switch main
Update the main branch:
git pull
git branch
git branch -d <new_branch>
git branch -D <new_branch> # delete force
If you work in a Team on GitHub, then every Member should make a Fork of the remote Repository.
