-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNotatki z GITa.txt
46 lines (31 loc) · 1.69 KB
/
Notatki z GITa.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
GIT BASICS
Initializing GIT repo and connecting it to remote repo on GitHub:
# Initiailze git repo
git init
# Add and commit file already existing in directory
git add .
git commit -m "Some meaningful commit comment"
# "Connect" remote repo on GitHub to the local repo
git remote add [URL to repo on github]
# Push all changes (add files) to remote,
# -f will ignore and overwrite existing remote repo with files from local repo
# -u will set this remote repo (named origin by default) as default for all pushes
git push -u -f origin master
Also, here's sample git config file to better understand what's master and what's origin:
[remote "origin"]
url = ...
fetch = ...
[branch "master"]
origin is remote repository, while master is a branch.
SOME PERSONAL NOTES
Opis podłączania się pod inne repo, robienia forka z tego,
1. Wpierw na githubie, na słuzbowym koncie robię forka mojego prywatnego repo.
2. Robie checkout za pomocą: git clone
Katalog, w którym jesteśmy odpowiada http://github.com/example_account/, robiąc checkout http://github.com/example_account/[jakiekowliek repo] w lokalizacji tworzone jest [jakiekowliek repo].
Aby dodać oryginalny (czyli u nas będzie to projekt OpenProject) projekt, tak aby móc sobie z niego aktualizować też zmiany, należy wykonać
git remote add upstream http://github.com/mturczyn/anothertestrepo
Wówczas updateujemy sobie nastepująco (z orginalnego repo):
git pull upstream master
Żeby lokalnie sobie zupdateować, używamy:
git pull origin master
Uwaga: "origin" to domyslne źródło pushów i pullów, natomiast "upstream" (nazwę sami wybieramy, ale taka jest konwencja w forkach) jest "połączeniem" do oryginalnego repo, które forkowaliśmy.