-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommands.txt
69 lines (44 loc) · 1.64 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
66
67
68
69
First time setup in new machine/new company
git config --global user.name "John Doe"
git config --global user.email [email protected]
Pull from base repo whil working on a fork repo
=================================================
git pull **original repo url** master
git remote add upstream **git path of original repo**
git fetch upstream
git merge upstream/master
git remote rm upstream
Pull pr's
==========
point master to new branch -- ill advised
git pull upstream pull/<pull_request_number>/head
create a new branch and point to that -- advised
git fetch upstream pull/<pull_request_number>/head:newbranch
Eg: git fetch upstream pull/4558/head:4558
another way
================================
git pull origin pull/1984/head
Reset Heads for commits without file changes
===============================================
git checkout master
git fetch upstream
git reset --hard upstream/master
git push --force
Follow these steps to enable git in local project for pushing on to Github
==========================================================================
1) git init
2) git add .
3) git commit -m "Add all my files"
4) git remote add origin https://github.com/yourusername/your-repo-name.git
Upload of project from scratch require git pull origin master.
5) git pull origin master
6) git push origin master
Pull particular files from commits into a remote branch
===========================================================
create a local branch first
git checkout --patch pr_<PR NUMBER> src/blah/blah.filename
Good practice
===============================
git config pull.rebase true
Easy rebasing
git config pull.rebase true