GithubHelp home page GithubHelp logo

git-cmds's Introduction

Commands for Git on Bash

Fundamental Concepts

  • directory
  • workplace
  • stage
  • (local) repository
  • remote (repository)

Preparation

  • ssh-keygen -t rsa -C "[email protected]" generate ssh key

  • git config --global user.name Mark set global user name

  • git config --global user.email [email protected] set global user email

  • git init initialize (create) workplace at current working directory

  • git config --global credential.helper store save GitHub account and password after inputting permanently

  • git remote add origin https://github.com/Markhng/git-test add remote (repository) named "origin"

  • git config --local commit.gpgsign true set GPG-sign as default

Commonness

  • git add . add all files in the current working directory to stage

  • git commit [-a] -m "note" commit all files from stage to (local) repository with note. [-a] means commit all files from workplace to repository directly

  • git push [remote-name] [branch-name] push all files from stage to branch of remote

  • git rm -r --cached file.ext untrack file.ext after

  • git rm -r --cached .;git add .;git commit -m 'update .gitignore' reload stage while .gitignore not work

Advanced Operations

  • git log --stat show the brief log (changes of lines)

  • git reset HEAD~1 undo last operation

git filter-branch --force --index-filter 'git \
rm --cached --ignore-unmatch SECURE.txt' \
--prune-empty --tag-name-filter cat -- --all

remove SECURE file completely

FAQ

$ git pull origin
You asked to pull from the remote 'origin', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.
$ git pull origin master --allow-unrelated-histories

git-cmds's People

Contributors

huangyxi avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.