대략 흐름
Local Repository1 --push--> Remote Repository
Local Repository2 <--clone-- Remote Repository
Local Repository2 --push--> Remote Repository
Local Repository1 <--pull-- Remote Repository
Local Repository1 --push--> Remote Repository
Local Repository2 <--pull-- Remote Repository
$ git remote add origin https://github.com/~~~/git-study.git
$ git remote
origin
$ git remote -v
origin https://github.com/~~~/git-study.git (fetch)
origin https://github.com/~~~/git-study.git (push)
$ git push
fatal: The current branch main has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin main
To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.
$ git push --set-upstream origin main
Enumerating objects: 13, done.
Counting objects: 100% (13/13), done.
Delta compression using up to 8 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (13/13), 949 bytes | 949.00 KiB/s, done.
Total 13 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (1/1), done.
To https://github.com/~~~/git-study.git
* [new branch] main -> main
branch 'main' set up to track 'origin/main'.
$ git clone https://github.com/~~~/git-study.git
Cloning into 'git-study'...
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 13 (delta 1), reused 13 (delta 1), pack-reused 0 (from 0)
Receiving objects: 100% (13/13), done.
Resolving deltas: 100% (1/1), done.
$ git remote
origin
$ git remote -v
origin https://github.com/~~~/git-study.git (fetch)
origin https://github.com/~~~/git-study.git (push)
$ vi hello.txt
$ git status
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: hello.txt
no changes added to commit (use "git add" and/or "git commit -a")
$ git add hello.txt
$ git commit -m "backup2"
[main 6c6b0ac] backup2
Committer: unknown <1111@~~~~~.com>
1 file changed, 2 insertions(+), 1 deletion(-)
$ git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3), 244 bytes | 244.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To https://github.com/~~~/git-study.git
02c8304..6c6b0ac main -> main
$ git log
commit 6c6b0acd25265f8ff8c33ead14b77af0303b8a32 (HEAD -> main, origin/main, origin/HEAD)
Author: unknown <1111@~~~~~.com>
Date: Thu Sep 4 11:23:30 2025 +0900
backup2
commit 02c83049a7f582cfa7a4977d4f9d7d1a6380f491
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 23:02:41 2025 +0900
Revert "r4"
This reverts commit 55da572beb18e1888c4ebdb64bc6127c054ab71b.
commit 55da572beb18e1888c4ebdb64bc6127c054ab71b
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 22:38:18 2025 +0900
r4
commit f56068461e55712ccf5cc0553615a3bbfb084e09
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 22:38:03 2025 +0900
r3
commit 26eb89e1026b4d9f0b1d171f4ff37d8db04a4ec5
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 20:29:20 2025 +0900
message 2
commit 2eb09a5abdf2bef1d7c119e42ec2dc70bf93e312
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 20:21:52 2025 +0900
message 1
$ git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Total 3 (delta 0), reused 3 (delta 0), pack-reused 0 (from 0)
Unpacking objects: 100% (3/3), 224 bytes | 14.00 KiB/s, done.
From https://github.com/~~~/git-study
02c8304..6c6b0ac main -> origin/main
Updating 02c8304..6c6b0ac
Fast-forward
hello.txt | 3 ++-
$ git log
commit 6c6b0acd25265f8ff8c33ead14b77af0303b8a32 (HEAD -> main, origin/main, origin/HEAD)
Author: unknown <1111@~~~~~.com>
Date: Thu Sep 4 11:23:30 2025 +0900
backup2
commit 02c83049a7f582cfa7a4977d4f9d7d1a6380f491
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 23:02:41 2025 +0900
Revert "r4"
This reverts commit 55da572beb18e1888c4ebdb64bc6127c054ab71b.
commit 55da572beb18e1888c4ebdb64bc6127c054ab71b
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 22:38:18 2025 +0900
r4
commit f56068461e55712ccf5cc0553615a3bbfb084e09
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 22:38:03 2025 +0900
r3
commit 26eb89e1026b4d9f0b1d171f4ff37d8db04a4ec5
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 20:29:20 2025 +0900
message 2
commit 2eb09a5abdf2bef1d7c119e42ec2dc70bf93e312
Author: unknown <1111@~~~~~.com>
Date: Wed Sep 3 20:21:52 2025 +0900
message 1