git常见命令
首页 > 综合 > 正文

git常见命令

来源:哔哩哔哩 2023-08-02 15:19:02

简单汇总下git常见命令:

create your own folder

mkdir aacd aa

verify that the current folder is 「not」tracked by Git:


(资料图片)

git status

create a new SAS program file

echo "proc options; run;" > ./pgm/

initialize a new repo by using the 「git init」command

git init --initial-branch==main

This command creates a new git repository skeleton in a subdirectory named '.git' under the current directory. This meas that you're now able to start using other git commands in the current directory.

git configuration

git config --list --show-origin | grep user

or use this command in windows to check whether you set your name and email of github:

git config --list --show-origin | findstr user

optional: set your basic identification configuration settings

git config --global  "First-name Last-name"git config --global  emailAddress@provider

stage your project files with the 「git add」command

git add .git status

commit the files, we can use whether commit message (comment) we want

git commit -m 'initial commit'

edit files, we can just use the ">>" to append something to the existing file's content

echo "/* adding just a comment to the code */" >> ./pgm/

stage and commit the files with this shortcut (-am means stage all and commit together)

git commit -am "added a comment"

check repo history using the 「git log」command

git log --pretty=format:"%h %ae %s"

the 「pretty」option specifiers can make a more concise, readable history log with certain fields.

or can use the 「--oneline」option for a quick view:

git log --oneline

push to a remote repository

<!-- git remote add origin <remote_repo_url> --> #only do this oncegit push -u origin main

pull from a remote repository

git pull origin main

github链接:/Leslie-Lu/SASGit

Did you find this page helpful? Consider sharing it

关键词:

热图推荐

Copyright @ 2008-2017 news.baoshe.net All Rights Reserved 报社网 版权所有 京ICP备12018864号-10

联系我们:291 32 36@qq.com

营业执照公示信息