-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit.py
More file actions
133 lines (93 loc) · 3.01 KB
/
Copy pathgit.py
File metadata and controls
133 lines (93 loc) · 3.01 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# //GIT bash
git -v
pwd
# cd d: chage into d
cd filename/
cd .. #go to the previous folder
dir OR ls list files
mkdir #folder/directory creation
#create file
touch filename.txt
echo "Your text to add" >> filename.txt
#read file
cat my_file.txt
# Set
git config --list
#
ls: The command to list files and directories.
-a: The flag to include hidden files.
ls -la #long lositing
git init
#This will create a Git repository for your project. You can then start adding files, committing changes, and managing your project's history using Git.
git add <file>: Stages changes in a file to be committed.
git add .: Stages all changes in the current directory to be committed.
git rm -r --cached <file>: Removes a directory and all its contents from the index.
git commit -m "Commit message": Creates a commit with a specified message.
git log #all committed changes
# press q to quit
git log --oneline
create .gitignore File
#in this file mention the file you don't want to track[.nodemodules, .echo]
git status #check the status of the files
git add .
git commit -m "added .gitignore"
#Branches
git BRANCH
git branch <branch_name>: Creates a new branch.
**** git checkout <branch_name>: Switches to a different branch.
git switch <branch_name>: Switches to a different branch.
#if we swich from main or master branch and add a file to another branch
Switched to branch 'test'
SHUBHRADEEP MAITY@Robin MINGW64 /d/Down10ads/Git (test)
S git branch
master
* test
SHUBHRADEEP MAITY@Robin MINGW64 /d/Down10ads/Git (test)
$ touch testing. js
SHUBHRADEEP MAITY@Robin MINGW64 /d/Down10ads/Git (test)
$ echo var a=10 >>testing.js
SHUBHRADEEP MAITY@Robin MINGW64 /d/Down10ads/Git (test)
$ cat testing. js
var a—10
#after add and commit => again switch to main or master branch the new added file will be dis appare
# if you want to see the new added file point the head to the new branch where the changes occour
git checkout master
git merge <branch_name>: Merges changes from another branch into the current branch.
#conflict
<<<<<<< HEAD
var b=120
var c=620
=======
var b=100
>>>>>>> test
#resolove it manually or using VS CODE
#add . #commit -m ''
#rename
git branch -m <old_branch_name> <new_branch_name>
git branch -d <branch nasme> #del
#temporarily saving your changes and restoring them
git stash
git stash apply
#rebase
git checkout testbranch
git rebase master
#GITHUB
git remote: Lists all remote repositories.
git remote add <name> <url>: Adds a remote repository.
git push origin main
# This pushes the main branch from your local repository to the origin remote.
#Change the Remote URL:
git remote set-url origin <new_remote_url>
git clone <url>: Creates a local copy of a remote repository.
# colleboration
#fork
git switch -C newbranch
git branch [Give the current branch name]
git push -u origin newbranch
#main
git switch newbranch
git switch main
git merge newbranch
git push origin main
#fork
git pull