0% found this document useful (0 votes)
1K views

GIT For Dummies

Git for Dummies provides a guide for using Git and GitLab to collaborate on code projects. It outlines two preferred workflows: [1] creating a new branch before working on code changes, committing changes to that branch, and creating a merge request; [2] stashing uncommitted changes if you forgot to create a branch first, then creating and switching to a new branch to commit the changes and create a merge request. It notes the risks of working on code without branching first and advises creating a zip file backup before using Git if unfamiliar. The document congratulates the reader on learning to collaborate using version control.

Uploaded by

Dia Varga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

GIT For Dummies

Git for Dummies provides a guide for using Git and GitLab to collaborate on code projects. It outlines two preferred workflows: [1] creating a new branch before working on code changes, committing changes to that branch, and creating a merge request; [2] stashing uncommitted changes if you forgot to create a branch first, then creating and switching to a new branch to commit the changes and create a merge request. It notes the risks of working on code without branching first and advises creating a zip file backup before using Git if unfamiliar. The document congratulates the reader on learning to collaborate using version control.

Uploaded by

Dia Varga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

GIT for Dummies

===================================================================================
================

(A) Prefered way to work:


Step 1: Create new branch on gitlab

Step 2:
git pull OR git fetch --all (get new branches)
git checkout <branch name comes here> (switch to the new fresh and
lovely branch)

Step 3: Work on code, don't forget to have fun :)

Step 4:
git status (many red lines
suppose to be here)
git add --all (add changes to
commit)
git status (all lines suppose
to be green)
git commit -m "Commit message comes here" (commit message, always write
relevant and informative stuff max 1-3 sentence)
git push (push changes to
server)

Step 5:
Don't forget to create merge request on gitlab

(B) In case you forgot to create new branch and worked on master or other branch:

Step 1:
git stash (saves changes to
a temporary space)

Step 2: Create a new branch on gitlab

Step 3:
git pull OR git fetch --all (get new branches)
git checkout <branch name comes here> (switch to the new fresh and
lovely branch)
git stash pop (apply changes on
other branch???)
git status (many red lines
suppose to be here)
git add --all (add changes to
commit)
git commit -m "Commit message comes here" (commit changes, "" signs are
mandatory)
git push (push changes to
server)

Step 3:
Don't forget to create merge request on gitlab

NOTES:
* Working on code before creating a branch always risky, try to create branch
before you starting to work on code (version A).
* If you are not familiar with gitlab ALWAYS create a zip file before you
start to work with git inorder to prevent code losses.
* If you notice any weird message (which didn't happend before / shouldn't be
there) ask someone experienced before do anything else.

Congratulation, you did the next step to collaborate on awsome projects with other
team members :)

You might also like