Maintain the repository using Git

Refer to the thoughbot’s guide,
https://github.com/thoughtbot/guides/tree/master/protocol/git
and
http://www.ruanyifeng.com/blog/2015/08/git-use-process.html
and
https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository

From these two articles, We can know how to manager the repository using gig and the ways he maintains the repository. I paste all the content of his article below.

While one thing has to be paid attention to:

1 The adding or modifing on config file like config.js would be ignored. Check the file with
nano .gitigore
to see if it’s tracked and ignored.
2 Or
git add config.js -f
to add the files needed to commit.
3 when running
git commit –verbose
to track all the updates. The listed commit have to be uncomment, like
Changes to be committed:
modified: app.js

otherwise, changes won’t be executed.

Write a Feature

Create a local feature branch based off master.

git checkout master
git pull
git checkout -b
Rebase frequently to incorporate upstream changes.

git fetch origin
git rebase origin/master
Resolve conflicts. When feature is complete and tests pass, stage the changes.

git add –all
When you’ve staged the changes, commit them.

git status
git commit –verbose
Write a good commit message. Example format:

Present-tense summary under 50 characters

* More information about commit (under 72 characters).
* More information about commit (under 72 characters).

http://project.management-system.com/ticket/123
If you’ve created more than one commit, use git rebase interactively to squash them into cohesive commits with good messages:

git rebase -i origin/master
Share your branch.

git push origin
Submit a GitHub pull request.

Ask for a code review in the project’s chat room.

Review Code

A team member other than the author reviews the pull request. They follow Code Review guidelines to avoid miscommunication.

They make comments and ask questions directly on lines of code in the GitHub web interface or in the project’s chat room.

For changes which they can make themselves, they check out the branch.

git checkout
./bin/setup
git diff staging/master..HEAD
They make small changes right in the branch, test the feature on their machine, run tests, commit, and push.

When satisfied, they comment on the pull request Ready to merge.

Merge

Rebase interactively. Squash commits like “Fix whitespace” into one or a small number of valuable commit(s). Edit commit messages to reveal intent. Run tests.

git fetch origin
git rebase -i origin/master
Force push your branch. This allows GitHub to automatically close your pull request and mark it as merged when your commit(s) are pushed to master. It also makes it possible to find the pull request that brought in your changes.

git push –force-with-lease origin
View a list of new commits. View changed files. Merge branch into master.

git log origin/master..
git diff –stat origin/master
git checkout master
git merge –ff-only
git push
Delete your remote feature branch.

git push origin –delete
Delete your local feature branch.

git branch –delete

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s