]> rtime.felk.cvut.cz Git - hubacji1/oneflow.git/blob - remote.md
Add coffe
[hubacji1/oneflow.git] / remote.md
1 # Remote
2 The repository may be stored on remote, usually a server. The remote is added
3 automatically when `git clone` and needs to be added manually by `git remote
4 add NAME URL` when `git init` used.
5
6 The main remote is usually named `origin`.
7
8 # Update - copy the repository changes
9 When copying repository history to the server, `git push` command is used. If
10 copying from the server to local repository clone, `git pull --rebase` is the
11 proper command.
12
13 This `--rebase` options first download all new changes in repository on server
14 and on top of them then apply local changes. Even that timestamp info is
15 forgotten (so the local changes looks like has been done just after copying
16 repository from server is finished) it is preffered over `git pull` because the
17 history is cleaner.
18
19 # Collaboration
20 Git can be used for collaboration even without branching. There are few rules
21 that can ease the collaboration if keeped:
22 - Git history on remote (shared) server must not be overwritten.
23 - Every time before `git push` do `git pull --rebase`.
24   - And solve the conflicts.
25 - Push to remote only clear, conflicts free git history.
26
27 # Cheat sheet
28 Use `git COMMAND --help` for showing the help!
29
30 ## Remote
31 - `git remote add NAME URL`
32 - `git config --global branch.autosetuprebase always`
33
34 ## Update
35 - `git push`
36 - `git pull --rebase`