-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgit basics
More file actions
72 lines (55 loc) · 2 KB
/
git basics
File metadata and controls
72 lines (55 loc) · 2 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
pushing onto github for the first time:
git init
git status
git add . or git add --a
git status
git commit -m ""
git remote add origin httpadress
git push -u origin master
adding updations and files on an already existing repo
These are the commands to follow:
1. Git status
2. Git add . (to add all files to staging)
3. Git status (to view the status)
4. Git commit -m “second commit”
5. Git status
6. Git pull
7. Git push -u origin master
//in case you get this error after typing this
$ git pull
error: Your local changes to the following files would be overwritten by merge:
README.md
Please commit your changes or stash them before you merge.
Aborting
$ git push -u origin master
To https://github.com/elevateagency/Geekster-.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/elevateagency/Geekster-.g
it'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
(fix it like this)
-git stash
-git pull
-git push -u origin master
$ git stash
Saved working directory and index state WIP on master: 7ee25ca fourth commit
$ git pull
Merge made by the 'recursive' strategy.
README.md | 12 +++---------
git basics | 19 +++++++++++++++++++
2 files changed, 22 insertions(+), 9 deletions(-)
create mode 100644 git basics
$ git push -u origin master
Enumerating objects: 16, done.
Counting objects: 100% (13/13), done.
Delta compression using up to 8 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (8/8), 2.36 KiB | 1.18 MiB/s, done.
Total 8 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To https://github.com/elevateagency/Geekster-.git
fe37680..2f20b00 master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.