Usage

Terminal based Usage

Setup Global User in Terminal

$ git config --global user.name "FIRST_NAME LAST_NAME"
$ git config --global user.email "MY_NAME@tu-dresden.de"

Clone Remote Repository

Clone the repository using the HTML link from the clone option in GitLab.

$ git clone ssh://git@141.30.80.100:7999/Group/SubGroup/project.git

How it works

The git add and git commit commands compose the fundamental Git workflow. These are the two commands that every Git user needs to understand, regardless of their team’s collaboration model. They are the means to record versions of a project into the repository’s history.

Developing a project revolves around the basic edit/stage/commit pattern. First, you edit your files in the working directory. When you’re ready to save a copy of the current state of the project, you stage changes with git add. After you’re happy with the staged snapshot, you commit it to the project history with git commit. The git reset command is used to undo a commit or staged snapshot.

In addition to git add and git commit, a third command git push is essential for a complete collaborative Git workflow. git push is utilized to send the committed changes to remote repositories for collaboration. This enables other team members to access a set of saved changes.

Add changes to Remote Repository

whenever the code is modified you can always add them to you git.

$ git add .

Commmit Changes

Commit set a message about the changes you were done. The commit also saves a revision of the code and you can revert the code to any version anytime in one click. A commit is kind of ‘object’ in git, and identifies and specifies a ‘snapshot’ of the branch at the time of the commit.

$ git commit -m "message"

Push changes to Remote

The git push command is used to upload local repository content to a remote repository. Pushing is how you transfer commits from your local repository to a remote repo. It’s the counterpart to git fetch, but whereas fetching imports commits to local branches, pushing exports commits to remote branches. Remote branches are configured using the git remote command. Pushing has the potential to overwrite changes, caution should be taken when pushing.

for git deteched enviornements you have to use

$ git push origin HEAD:<target branch>

for pushing to an empty repositories use:

$ git push --set-upstream origin master

General schema for git push:

$ git push <remote> <branch>

Setting up an empty repository

A Git repository is a virtual storage of your project. It allows you to save versions of your code, which you can access when needed.

You’ll first cd to the root project folder and then execute the git init command.

$ cd /path/to/your/existing/code
$ git init

Pointing git init to an existing project directory will execute the same initialization setup as mentioned above, but scoped to that project directory.

git init <project directory>

Ignoring files

Ignored files are tracked in a special file named .gitignore that is checked in at the root of your repository. There is no explicit git ignore command: instead the .gitignore file must be edited and committed by hand when you have new files that you wish to ignore. .gitignore files contain patterns that are matched against file names in your repository to determine whether or not they should be ignored.

VS Code Tutorial for gitlab tools

Clone Remote Repository

Add changes to Remote Repository

Commmit Changes

Push changes to Remote

Create Repository/Projects and Groups