-
Notifications
You must be signed in to change notification settings - Fork 0
/
commandsGit.txt
47 lines (32 loc) · 1.69 KB
/
commandsGit.txt
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Assign user to active session
git config --global user.name "<your_name>"
Assign email to active session:
git config --global user.email "<your_email>"
Create a new branch or branch:
git checkout -b <branch name>
Change branch/branch:
git checkout <branch name>
Validate modified files within the project. In red it shows the modified files. In green, it shows the files that were added by "git add":
git status
Placing the modified file in a safe area (The "." after the 'git add' command adds all files in red indicated after the git status):
git add .
Create a new version of the project with the creator references:
git commit -m "<change_text>"
Change the main branch name from master to main (this is currently recommended best practice)
git branch -M "main"
Transferring the commit from the local repository (from my machine) to a repository on the Github platform (Origin is the name used to refer to our repository. Once this is done, the local repository will be connected to the Github repository, however, the commit we give on the machine does not automatically go up to the platform...)
git remote add origin <repository link>
Upload, for the first time, the changes to the remote repository (github):
git push -u origin <branch you want to push (main or develop, for example)>
Up, after the first time (without the "-u", the changes to the remote repository (github)):
git push origin <branch you want to push (main or develop, for example)>
Pull changes from repository:
git pull
Validate my comments and modifications:
git log
Add the contents of the current branch to the contents of another branch:
git merge <branch_name>
Show the changes made:
gitk
To check the installed git version
git -v