xref: /expo/docs/pages/eas-update/eas-cli.mdx (revision d7273661)
1---
2title: Use EAS Update with EAS CLI
3sidebar_title: Use EAS CLI
4description: Learn how to use link a branch to a channel and publish updates with EAS CLI.
5---
6
7import ImageSpotlight from '~/components/plugins/ImageSpotlight';
8import { Terminal } from '~/ui/components/Snippet';
9
10EAS Update works by linking _branches_ to _channels_. Channels are specified at build time and exist inside a build's native code. Branches are an ordered list of updates, similar to a Git branch, which is an ordered list of commits. With EAS Update, we can link any channel to any branch, allowing us to make different updates available to different builds.
11
12<ImageSpotlight
13  alt={`Channel "production" linked to branch "version-1.0"`}
14  src="/static/images/eas-update/channel-branch-link.png"
15/>
16
17The diagram above visualizes this link. Here, we have the builds with the "production" channel linked to the branch named "version-1.0". When we're ready, we can adjust the channel–branch pointer. Imagine we have more fixes tested and ready on a branch named "version-2.0". We could update this link to make the "version-2.0" branch available to all builds with the "production" channel.
18
19<ImageSpotlight
20  alt={`Channel "production" linked to branch "version-2.0"`}
21  src="/static/images/eas-update/channel-branch-link-2.png"
22/>
23
24## Inspecting the state of your project's updates
25
26### Inspect channels
27
28View all channels:
29
30<Terminal cmd={['$ eas channel:list']} />
31
32View a specific channel:
33
34<Terminal
35  cmd={['$ eas channel:view [channel-name]', '', '# Example', '$ eas channel:view production']}
36  cmdCopy="eas channel:view [channel-name]"
37/>
38
39Create a channel:
40
41<Terminal
42  cmd={['$ eas channel:create [channel-name]', '', '# Example', '$ eas channel:create production']}
43  cmdCopy="eas channel:create [channel-name]"
44/>
45
46### Inspect branches
47
48See all branches:
49
50<Terminal cmd={['$ eas branch:list']} />
51
52See a specific branch and a list of its updates:
53
54<Terminal
55  cmd={['$ eas branch:view [branch-name]', '', '', '# Example', '$ eas branch:view version-1.0']}
56  cmdCopy="eas branch:view [branch-name]"
57/>
58
59### Inspect updates
60
61View a specific update:
62
63<Terminal
64  cmd={[
65    '$ eas update:view [update-group-id]',
66    '',
67    '# Example',
68    '$ eas update:view dbfd479f-d981-44ce-8774-f2fbcc386aa',
69  ]}
70  cmdCopy="eas update:view [update-group-id]"
71/>
72
73## Changing the state of your project's updates
74
75### Create a new update and publish it
76
77<Terminal
78  cmd={[
79    '$ eas update --branch [branch-name] --message "..."',
80    '',
81    '# Example',
82    '$ eas update --branch version-1.0 --message "Fixes typo"',
83  ]}
84  cmdCopy="eas update --branch [branch-name] --message"
85/>
86
87If you're using Git, we can use the `--auto` flag to auto-fill the branch name and the message. This flag will use the current Git branch as the branch name and the latest Git commit message as the message.
88
89<Terminal cmd={['$ eas update --auto']} />
90
91### Delete a branch
92
93<Terminal
94  cmd={['$ eas branch:delete [branch-name]', '', '# Example', '$ eas branch:delete version-1.0']}
95  cmdCopy="eas branch:delete [branch-name]"
96/>
97
98### Rename a branch
99
100Renaming branches do not disconnect any channel–branch links. If you had a channel named "production" linked to a branch named "version-1.0", and then you renamed the branch named "version-1.0" to "version-1.0-new", the "production" channel would be linked to the now-renamed branch "version-1.0-new".
101
102<Terminal
103  cmd={[
104    '$ eas branch:rename --from [branch-name] --to [branch-name]',
105    '',
106    '# Example',
107    '$ eas branch:rename --from version-1.0 --to version-1.0-new',
108  ]}
109  cmdCopy="eas branch:rename --from [branch-name] --to [branch-name]"
110/>
111
112### Republish a previous update within a branch
113
114We can make a previous update immediately available to all users. This command takes the previous update and publishes it again so that it becomes the most current update on the branch. As your users re-open their apps, the apps will see the newly re-published update and will download it.
115
116> Republish is similar to a Git reversion, where the correct commit is placed on top of the Git history.
117
118<Terminal
119  cmd={[
120    '$ eas update:republish --group [update-group-id]',
121    '$ eas update:republish --branch [branch-name]',
122    '',
123    '# Example',
124    '$ eas update:republish --group dbfd479f-d981-44ce-8774-f2fbcc386aa',
125    '$ eas update:republish --branch version-1.0',
126  ]}
127/>
128
129> If you don't know the exact update group ID, you can use the `--branch` flag. This shows a list of the recent updates on the branch and allows you to select the update group to republish.
130