-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit_notes_1
More file actions
29 lines (22 loc) · 1.38 KB
/
git_notes_1
File metadata and controls
29 lines (22 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
GITLAB
git init ----> to initialise git
git add <file_name> ----> to add the file / changes (staged)
git rm <file_name> ----> to remove the file
git add . ----> to add all the changes in the repo
git commit -m <"Commit_message"> ----> to commit the changes (tracked changes)
git push origin <main> ----> to push the committed changes to main branch
git clone <git_https_url> ----> to clone the repository
git log ----> to check the logs
git checkout <dev> ----> to switch the branch to Dev ( can use switch instead of checkout)
git checkout -b <branch_name> ----> to create new branch
git branch ----> to check the which branch we are in
git branch -a ----> to check the all branches in the repo
git remote -v ----> to check which repository it points to
git remote set-url origin <ssh_url> ----> to change the origin url from https to ssh
git remote set-url origin https://<access_token><https_url> ----> to auth through access token for https
To auth Github from local - create ssh keys.
ssh-keygen ----> to create keygen to auth repo on github
copy contain of public key and go to profile icon - settings - ssh & gpg keys - ssh keys - add public key there.
Personal access token - https
create personal access token from settings - developer setting - personal access token - token(classic) - generate new token
git remote add origin https://<personal access token>@git_https_repo_url