-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGit_instructions.txt
More file actions
36 lines (26 loc) · 1.64 KB
/
Git_instructions.txt
File metadata and controls
36 lines (26 loc) · 1.64 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
Git instuctions
1) Setting your user/developer name and email address. This is important because for every commit Git uses this information, and it's
immutably baked into the commits in your repository:
git config --global user.name "Your developer name"\par
git config --global user.email your_developer@email.com\par
2) Downloading a repository. To download a repository from the internet run:
git clone https://github.com/user_name/project_name.git
3) Changing branch name. By default Git will create a branch called "master" when you create a new repository with git init.
From Git 2.28 onwards, you can set a different name for the initial branch. For example, to set "main" as the default branch name run:
git config --global init.defaultBranch main
4) Removing files. To remove a file from Git, you have to remove it from your tracked files (more precisely, from your staging area) and
then commit. The "git rm" command does that, and also removes the file from your working directory so you don\rquote t see it as an
untracked file the next time around.
git rm unwanted_file
5) Moving/renaming files. If you want to rename a file in Git, you can run this command:
git mv old_file_name new_file_name
6) Checking files that have changed. Run:
git status
7) Adding files to your local repository. Run:
git add file_name
8) Commiting your changes. (It's only local)
git commit -m "Your message"
9) Pushing your changes. Push your changes to the remote server:
git push
10) Extracting files from a local repository to a specific location:
git clone origin_repo_location target_location