Git-Github

Get Started. It's Free
or sign up with your email address
Git-Github by Mind Map: Git-Github

1. Git-Github

1.1. Fix your mistakes when using GitHub

1.1.1. Unstage afile you accidentally added before a commit To remove a staged file you don't need, use the following command: git rm --cached <filename> How to get rid of a file you accidentally commited. You have a few options. The safest is : git revert If you committed a file, and now you want to uncommit it: git revert HEAD --no-edit git log this command will give you a list the commits you made in reserve chronological order.

1.1.2. This is to change the kast commit message using the folowing command: git commit --amend

1.1.3. This command will take your files back to the staging area: git reset --soft HEAD

1.1.4. You can move your working directory to the right branch, and do your commit with the following commands: git checkout new branch

1.1.5. Remove the last n commits from your working directory. It doesn't delete the commits commits completely: git reset HEAD~3

1.1.6. Doing the reset, and removing the files from the staging area to start over: git reset --hard

1.1.7. git rm : removes staged files. git revert : undoes a commit, but saves the correction as an additional commit over the mistake git reset : has more options to delete files and commits, but is risky to use! git commit -amend : changes your commit message

2. Take your first steps with Git

2.1. What is Git - Github ? What is git used for ?

2.1.1. Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency

2.1.2. GitHub is a code hosting platform for collaboration and version control.GitHub lets you (and others) work together on project

2.2. The diference between Git and Github ?

2.2.1. Git is versioning software, and GitHub is the code repository.

2.3. Lifecycle git

2.3.1. General workflow is as follows − You clone the Git repository as a working copy. You modify the working copy by adding/editing files. If necessary, you also update the working copy by taking other developer's changes. You review the changes before commit. You commit changes. If everything is fine, then you push the changes to the repository. After committing, if you realize something is wrong, then you correct the last commit and push the changes to the repository.

2.4. Create account github and install git for laptop

2.4.1. install for unbuntu git version install: sudo apt install git uninstall: sudo apt-get remove git

2.5. git config

2.5.1. git config --list username: git config --global user.name "newname" delete username: git config --global --unset user.username email, pass samething

2.6. procedure git clone and git push

2.6.1. clone: git clone "linkgithub"

2.6.2. git init git status git add . git commit -m "modify example" git remote and origin link git push -u origin master

3. Manage your mistakes when using GitHub

3.1. when you are working on the master branch in your local repository: git checkout wwbranch

4. Use Git tools to work as a team

4.1. What is branch workflow?

4.1.1. Using version control on Git, your team can create processes. Branch workflow is all about how your organization uses a process while working on a project in a code repository. It's a great way to streamline your software development project! It's teamwork! It's teamwork! What is a branch workflow, exactly? Good question! Let's start by taking a look at how we have been using branches so far. Start with your master branch. When you work on your local repository, you create another branch that originates from the master branch. However, teams don't just work on one branch. There are several branches with pull requests sent back to the remote repository to be merged into the master branch. Typically, branches that are merged into the master branch add a feature, solve an issue or create an alternate version, that can be used later. Before merging, teams test each branch to make sure they work with the current source code, and ensure they won't introduce bugs! 🐛 This process is a software development project workflow. So how does an organization determine what kind of a workflow suits its business needs? Well, that's up to the organization - all projects work differently!

4.2. Learn a popular workflow: GitFlow!

4.2.1. GitFlow has specific branches for specific roles and processes. There are feature, develop, release, and the master branch. You can also have a branch called hotfixes for quick fixes! Each team will handle a different part of the Git workflow, and will have its own designated branches to work on to streamline the process.