GIT guide for juniors

✨ Introductions

This guide is created for beginners to ensure the development and production branches are secure.

🚀 Let’s start

1) Get the repository:

First, you need to choose which type of connection to the GitHub repository suits you best.

SSH…


This content originally appeared on DEV Community and was authored by Levani (Leo)

✨ Introductions

This guide is created for beginners to ensure the development and production branches are secure.

🚀 Let's start

1) Get the repository:

First, you need to choose which type of connection to the GitHub repository suits you best.

  • SSH: Use this if you have it configured locally and the public key added in the (ssh) settings section on the GitHub website.

  • HTTPS: The basic option using your username and password.

git clone <repository_url>

2) Get all branches:

git fetch --all

3) Move to the dev branch:

git checkout <dev>

4) Create and move to a new branch:

git checkout -b <branch_name>

⚡ The branch name must be the task name.

5) Add changes or Undo changes:

Add changes

git add <file_name>

or

git add *

Undo changes to certain files if they were not added to git:

git checkout <file_name>

Removes an object from git repository, but not file:

git rm -r --cached <file_name>

⚡ Make sure that files not allowed in the remote repository have not been added.

  • For example: .env, cache files and temporary files.

6) Apply changes:

git commit -m 'branch_name: list of changes'

7) Push the new branch alongside the one from which you created it:

git push --set-upstream origin <branch_name>

8) Pull changes from a specific remote repository:

git pull origin <branch_name>

P.S. Follow the steps outlined above, and your project repository will remain secure.


This content originally appeared on DEV Community and was authored by Levani (Leo)


Print Share Comment Cite Upload Translate Updates
APA

Levani (Leo) | Sciencx (2024-07-23T18:52:14+00:00) GIT guide for juniors. Retrieved from https://www.scien.cx/2024/07/23/git-guide-for-juniors/

MLA
" » GIT guide for juniors." Levani (Leo) | Sciencx - Tuesday July 23, 2024, https://www.scien.cx/2024/07/23/git-guide-for-juniors/
HARVARD
Levani (Leo) | Sciencx Tuesday July 23, 2024 » GIT guide for juniors., viewed ,<https://www.scien.cx/2024/07/23/git-guide-for-juniors/>
VANCOUVER
Levani (Leo) | Sciencx - » GIT guide for juniors. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/23/git-guide-for-juniors/
CHICAGO
" » GIT guide for juniors." Levani (Leo) | Sciencx - Accessed . https://www.scien.cx/2024/07/23/git-guide-for-juniors/
IEEE
" » GIT guide for juniors." Levani (Leo) | Sciencx [Online]. Available: https://www.scien.cx/2024/07/23/git-guide-for-juniors/. [Accessed: ]
rf:citation
» GIT guide for juniors | Levani (Leo) | Sciencx | https://www.scien.cx/2024/07/23/git-guide-for-juniors/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.