学计算机记不住命令,记不住的命令行们

本文详细介绍了如何使用Git同步本地仓库与远程仓库A。首先通过`lsof-i:3000`检查3000端口进程,然后克隆远程仓库B到本地,将A作为远程仓库添加到B中,拉取A的更新并合并到本地,最后将更改推送到GitHub。过程中涉及`git pull`,`git push`,`git reset`等关键命令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一直在更新

查看占用3000端口的进程

lsof -i :3000

Sync fork repo B_REPOSITORY with upstream repo A_REPOSITORY

clone repo B_REPOSITORY to local

git clone B_REPOSITORY_URL

Add A_REPOSITORY as remote to local B_REPOSITORY(mostly called upstream)

git remote add upstream https://github.com/be-forked-repo.git

pull A_REPOSITORY remote(upstream)branch(like master)

git pull upstream master

puah to github B_REPOSITORY

git push origin master

Add all update file

git add -u

Show log

git log

Delete no related commit

git reset -- hard

git push origin HEAD --force

If you didn't publish changes, to remove latest commit, you can do

$ git reset --hard HEAD^

(note that this would also remove all uncommitted changes; use with care).

If you already published to-be-deleted commit, use git revert

$ git revert HEAD

Delete branch

git branch -D testing

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值