-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommands.txt
65 lines (55 loc) · 1.93 KB
/
Commands.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Git task
Tell Git who you are
Configure the author name and email address to be used with your commits.
Command
git config --global user.name "Sam Smith"
git config --global user.email [email protected]
Git task
Create a new local repository
Command
git init
Git task
Check out a repository
Command
git clone /path/to/repository
Git task
Add one or more files to staging (index):
Command
git add <filename> (With this we can specify list of files that we could like to push)
git add * (With this we can commit all files with in the directory)
Git task
Commit changes to head (but not yet to the remote repository):
Commit any files you've added with git add, and also commit any files you've changed since then:
Command
git commit -a
Git task
Send changes to the master branch of your remote repository:
Command
git push origin master
Git task
List the files you've changed and those you still need to add or commit:
Command
git status Push all tags to remote repository:
Git task
Connect to a remote repository
If you haven't connected your local repository to a remote server, add the server to be able to push to it:
List all currently configured remote repositories:
Command
git remote add origin <server>
git remote -v
Git task
You can use tagging to mark a significant changeset, such as a release:
CommitId is the leading characters of the changeset ID, up to 10, but must be unique. Get the ID using:
Push all tags to remote repository:
Command
git tag 1.0 <commitID>
git log
git push --tags origin
Git task
If you mess up, you can replace the changes in your working tree with the last content in head:
Changes already added to the index, as well as new files, will be kept.
Instead, to drop all your local changes and commits, fetch the latest history from the server and point your local master branch at it, do this:
Command
git checkout -- <filename>
git fetch origin
git reset --hard origin/master