-u, --upstream, --user (Upstream / User): Sets a tracking relationship or specifies which user/account an action runs as. -u is another overloaded flag. In git push -u origin feature it sets the upstream, so later git push and git pull know which remote branch belongs to your local one. In docker run -u 1000 and sudo -u deploy it sets which user a command runs as.
Frequently asked questions about -u, --upstream, --user (Upstream / User)
How is -u, --upstream, --user (Upstream / User) used in practice?
Setting the upstream once saves you typing the remote and branch name on every push. It also makes git status tell you how far ahead or behind the remote you are.
What should you keep in mind with -u, --upstream, --user (Upstream / User)?
The user meaning is about safety. Containers run as root by default, which means a bug in your application runs with full rights inside that container. Running as a normal user limits what an attacker could do. In a Dockerfile, set a USER line, and in commands that need it, run them as the least powerful account that can do the job.
Use before running or suggesting shell commands with flags, especially destructive or broad ones (-f/--force, -r/-R recursive, -a/--all, -y/--yes, prune, --hard), and when a user asks what a flag means (-v, -q, -n/--dry-run, -h, -o, -p, -t, -u, -w, -x, -c, -i). Explains flags per tool and prefers dry runs and narrow scopes.
Use this skill before running, or recommending, any Docker command that deletes, wipes, resets, or otherwise irreversibly changes state — even if the user just says to "clean up", "clear the cache", "start fresh", "wipe everything", "nuke it", "reset", "force remove", or "tear down" Docker resources. Covers generic Docker CLI destructive operations not owned by a more specific skill — `docker rm`,
Master ShellCheck static analysis configuration and usage for shell script quality. Use when setting up linting infrastructure, fixing code issues, or ensuring script portability.