Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git #8

Open
ZJLi2013 opened this issue Jul 24, 2019 · 0 comments
Open

git #8

ZJLi2013 opened this issue Jul 24, 2019 · 0 comments

Comments

@ZJLi2013
Copy link
Owner

initialize a repository from existing code

cd your_project_folder
git init
ls -la
// rm -rf .git

before commit anything

git status

add  .gitignore   

working directory, staging area, .git directory

git add -A #add all files to staging area

git reset # reset files from staging area to working directory

git commit -m "detail about changes to code" # from staging area to .git directory

git log #check the commit made

cloning a remot repo

git clone

view info about the remote repo

git remote -v
git branch -a #all branches about this repo

pushing changes

git diff
git status
git add -A
git commit -m "update "
git pull origin master #
git push origin master(branch)

common workflow

// create a new branch

git branch new-feature
git checkout new-feature

git push -u origin(name of local repo) new-feature(branch)

git branch -a //view all branches

git checkout master
git pull origin master
git branch --merged #the branched has merged so far
git merge new-features #will merge new-feature to master
git push origin master

deleteing a branch

git branch --merged
git branch -d new-feature #delete locally
git branch -a #still on remote repo
git push origin --delete new-feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant