1GH-REPO-SYNC(1) GitHub CLI manual GH-REPO-SYNC(1)
2
3
4
6 gh-repo-sync - Sync a repository
7
8
9
11 gh repo sync [<destination-repository>] [flags]
12
13
14
16 Sync destination repository from source repository. Syncing uses the
17 main branch of the source repository to update the matching branch on
18 the destination repository so they are equal. A fast forward update
19 will be used except when the --force flag is specified, then the two
20 branches will by synced using a hard reset.
21
22
23 Without an argument, the local repository is selected as the destina‐
24 tion repository.
25
26
27 The source repository is the parent of the destination repository by
28 default. This can be overridden with the --source flag.
29
30
31
33 -b, --branch <string>
34 Branch to sync (default: main branch)
35
36
37 --force
38 Hard reset the branch of the destination repository to match the
39 source repository
40
41
42 -s, --source <string>
43 Source repository
44
45
46
48 # Sync local repository from remote parent
49 $ gh repo sync
50
51 # Sync local repository from remote parent on specific branch
52 $ gh repo sync --branch v1
53
54 # Sync remote fork from its parent
55 $ gh repo sync owner/cli-fork
56
57 # Sync remote repository from another remote repository
58 $ gh repo sync owner/repo --source owner2/repo2
59
60
61
62
63
65 gh-repo(1)
66
67
68
69 Jun 2022 GH-REPO-SYNC(1)