git --help

You have an empty repository

To get started you will need to run these commands in your terminal.

New to Git? Learn the basic Git commands

Configure Git for the first time

git config --global user.name "username"
git config --global user.email "username@email.com"

Working with your repository

I just want to clone this repository

If you want to simply clone this empty repository then run this command in your terminal.


git clone ssh://git@172.16.0.3:7999/intermediate_test/gateway_testcases_new.git
My code is ready to be pushed

If you already have code ready to be pushed to this repository then run this in your terminal.


cd existing-project
git init
git add --all
git commit -m "Initial Commit"
git remote add origin ssh://git@172.16.0.3:7999/intermediate_test/gateway_testcases_new.git
git push -u origin master
My code is already tracked by Git

If your code is already tracked by Git then set this repository as your "origin" to push to.

提交修改:

git add <files>

git commit -a    选择需要更新的文件

最后执行以下操作:

cd existing-project
git remote set-url origin ssh://git@172.16.0.3:7999/intermediate_test/gateway_testcases_new.git
git push -u origin master

参考链接:https://confluence.atlassian.com/display/STASH0311/Importing+code+from+an+existing+project


Git 提供了丰富的命令帮助文档,可以通过内置的帮助系统查看各类命令的使用方法和说明。以下是一些常用的 Git 帮助方式及命令列表。 ### 查看 Git 命令帮助文档的方式 1. **查看所有可用命令的概览** ```bash git help -a ``` 2. **列出所有可用的 Git 命令及其简要描述** ```bash git --list-cmds=all ``` 3. **获取某个具体命令的详细帮助信息** ```bash git help <command_name> ``` 例如,查看 `git commit` 的帮助: ```bash git help commit ``` 4. **以网页形式打开完整的 Git 文档** ```bash git help --web ``` 5. **查看 Git 配置相关的帮助** ```bash git help config ``` 6. **查看 Git 常用命令分类** ```bash git help everyday ``` ### Git 常用命令类别与功能说明 - **基础操作类命令** 这些命令用于初始化仓库、添加文件、提交更改等基本版本控制操作。 - 初始化仓库:`git init` - 克隆远程仓库到本地:`git clone <repository_url>` - 添加文件到暂存区:`git add <file_name>` - 提交更改到本地仓库:`git commit -m "message"` - **分支管理类命令** 分支管理是 Git 的核心特性之一,允许开发者在不同分支上并行开发[^2]。 - 创建新分支:`git branch <branch_name>` - 切换分支:`git checkout <branch_name>` - 创建并切换分支:`git checkout -b <branch_name>` - 删除分支(已合并):`git branch -d <branch_name>` - 强制删除分支(未合并):`git branch -D <branch_name>` - 查看本地分支:`git branch` - 查看远程分支:`git branch -r` - 查看所有分支(本地和远程):`git branch -a` - **远程仓库操作类命令** 用于与远程仓库进行交互,包括推送、拉取和同步代码。 - 推送本地提交到远程仓库:`git push origin <branch_name>` - 拉取远程仓库更新:`git pull origin <branch_name>` - 查看远程仓库信息:`git remote -v` - 添加远程仓库地址:`git remote add origin <repository_url>` - **查看状态与日志类命令** 用于检查当前工作目录的状态以及查看提交历史记录。 - 查看当前工作区状态:`git status` - 查看提交历史:`git log` - 查看指定文件的修改历史:`git blame <file_name>` - **配置设置类命令** Git 支持多种级别的配置选项,包括全局和本地配置[^4]。 - 设置用户名(全局):`git config --global user.name "YourName"` - 设置邮箱(全局):`git config --global user.email "your@email.com"` - 列出所有配置项:`git config --list` - 禁用文件名大小写敏感(适用于 Windows 系统):`git config --local core.ignorecase false`[^3] - **高级操作类命令** 包括合并、变基、标签管理等更复杂的操作。 - 合并指定分支到当前分支:`git merge <branch_name>`[^2] - 将更改从一个分支应用到另一个分支:`git rebase <branch_name>` - 创建轻量标签:`git tag <tag_name>` - 创建附注标签:`git tag -a <tag_name> -m "message"` - **其他实用工具命令** - 显示 Git 当前版本:`git --version` - 显示 Git 内部对象数据库中的内容:`git cat-file -p <object_hash>` - 清理不必要的文件和优化本地仓库:`git gc` 通过上述命令,可以全面掌握 Git 的使用方式,并根据实际需求查阅相关文档进一步深入学习。Git 的官方文档也提供了详细的解释和示例,适合进阶用户参考。 ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值