Giter Club home page Giter Club logo

try_git's Introduction

Init

- git init
- git status
- git add fil.txt
- git status
- git commit -m "Adding files"
- git add '*.txt'
- git commit -m 'Adding all txt files'
- git log	==> history
- git remote add origin https://github.com/aditiasap/try_git.git
- git push -u origin master	==> push changes to remote with name origin, the default local branch is master. -u tell git to remember the parameters, so next time we can simply run "git push". 


- git pull origin master	==> To pull from remote repo for the newest version
- git diff HEAD			==> To check the different between the newest pull with our latest commit (HEAD pointer)
- git add octofamily/octodog.txt	==> Another scenario for staged differences below.
- git diff --staged		==> To check the different with the staged files. (Staged files are files not commited yet, but added)
- git reset octofamily/octodog.txt	==> To unstage files


- git checkout -- octocat.txt		==> [UNDO] To revert back the conditions where the last commit of octocat.txt. <target> is octocat.txt here

- git branch clean_up			==> create copy (branch) of code with name clean_up, which then can be merged to master once it ready
- git branch				==> List local branches
- git checkout clean_up			==> Switching branch to branch clean_up


- git rm '*.txt'			==> Remove files from disk and stage the removal for us. *.txt include all txt files inside subdirectory
- git commit -m "Remove all the cats"	==> Commit the removal


- git checkout master			==> switch to master branch so we can copy (or merge) back from clean_up branch into master branch

- git merge clean_up			==> merge clean_up branch into master branch

- git branch -d clean_up		==> since clean_up already merged, it no need anymore, so we delete it

- git push				==> push to remote repo

- git push origin master

Managing conflicts :
- git pull --rebase origin master ==> put commit to the top of master branch

Manual resolve conflicting files :
- git status
- git add <some-file>
- git rebase --continue

- git rebase --abort ==> back to previous rebase

Centralize workflow :
https://www.atlassian.com/git/tutorials/comparing-workflows#centralized-workflow

Feature branch workflow :
https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow

- git checkout -b marys-feature master
- git status
- git add <some-file>
- git commit

- git push -u origin marys-feature
- git push

File Pull Request..
Once done, Merge..

- git checkout master
- git pull
- git pull origin marys-feature
- git push

Good practice for developer to squash before pushing :
https://blog.carbonfive.com/2017/08/28/always-squash-and-rebase-your-git-commits/

try_git's People

Contributors

aditiasap avatar

Watchers

 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.