Skip to content

icesi-ops/00_git-training

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GIT Tranining

Initialize repository

You can make new local repository: git init or you can clone from remote repository: git clone <url>

Do:

Fork the repository https://github.com/icesi-ops/00_git-training alt text

Clone your forked repository

  • git clone https://github.com/ikermatias/00_git-training

Workflow

alt text
alt text

Branches

The branches are used for make new functions isolated.
'master' is default branch.

Do:

  • git checkout -b <my_name>

Util commands:

Command Description
git branch -d <branch_name> Delete branch
git branch View branches and highlight the current branch
git checkout <branch_name> Switch to branch
git checkout -b <branch_name> Create and switch new branch

Add and Commit

Do:

  • echo "your_name" >> names
  • git add <filename> or git add .
  • git commit -m "Add my name

Send your changes

Now that you have your changes in "HEAD" (local) you can send the change to remote repository.

Do:

  • git push origin master

Or Also you can send the changes to other branch of your remote repository

  • git push origin <branch_name>

Pull request (Github flow)

GitHub flow is a lightweight, branch-based workflow that supports teams and projects where deployments are made regularly.

Open pull request

Pull Requests initiate discussion about your commits. Because they're tightly integrated with the underlying Git repository, anyone can see exactly what changes would be merged if they accept your request.
alt text

Discuss and review your code

Once a Pull Request has been opened, the person or team reviewing your changes may have questions or comments. Perhaps the coding style doesn't match project guidelines, the change is missing unit tests, or maybe everything looks great and props are in order. Pull Requests are designed to encourage and capture this type of conversation. alt text

Update and merge

You can update local repository to newest commit

  • git pull

For merge current branch with other branch

  • git merge <branch_name>

Utils commands

Replace local changes

  • git checkout --

Undo all changes and commit

git fetch origin
git reset --hard origin/master  

REFERENCES