-
Notifications
You must be signed in to change notification settings - Fork 1
Git WorkFlow
Ihar Aliakseyeu edited this page Nov 15, 2022
·
10 revisions
Git workflow
- Fetch and merge changes from the remote
- Create a branch to work on a new project feature
- Develop the feature on your branch and commit your work
- Fetch and merge from the remote again (in case new commits were made while you were working)
- Push your branch up to the remote for review
following commands
- 'git clone' : Creates a local copy of a remote.
- 'git remote -v' : Lists a Git project’s remotes.
- 'git fetch' : Fetches work from the remote into the local copy.
- 'git merge origin/main' : Merges origin/master into your local branch.
- 'git push origin <branch_name>' : Pushes a local branch to the origin remote.
- 'git log --oneline --graph --decorate --all' : nice view of commit history
As a golden rule, it’s important to only use 'git rebase' on a local branch that we’re working on individually.
git rebase- solve conflicts
-
git rebase --continueonce you are satisfied with your changes
A .gitignore file lets Git know which files, folders, and patterns to ignore, and not track them.
- create a '.gitignore' file in the root folders
- add comments '# my comment'
- file names 'thumbs.db'
- folder names 'node_modules/' to exclude all entire files in it ... for more see patterns
Update local feature branch from remote main
-
git stashhide the generated changes in the branch git checkout maingit fetchgit merge origin/maingit checkout <local_feature_branch>git merge maingit stash pop