{"id":51765437,"url":"https://github.com/phien-ntace/how_to_use_git","last_synced_at":"2026-07-19T18:04:07.085Z","repository":{"id":300532777,"uuid":"190187765","full_name":"phien-ntace/how_to_use_git","owner":"phien-ntace","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-15T15:15:28.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-16T09:37:33.180Z","etag":null,"topics":["git"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phien-ntace.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-06-04T11:26:38.000Z","updated_at":"2025-07-15T15:15:31.000Z","dependencies_parsed_at":"2025-06-22T08:40:33.241Z","dependency_job_id":"31eca5ff-c3a4-4215-9e63-1fea42fd87ef","html_url":"https://github.com/phien-ntace/how_to_use_git","commit_stats":null,"previous_names":["phien-ntace/how_to_use_git"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/phien-ntace/how_to_use_git","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phien-ntace%2Fhow_to_use_git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phien-ntace%2Fhow_to_use_git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phien-ntace%2Fhow_to_use_git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phien-ntace%2Fhow_to_use_git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phien-ntace","download_url":"https://codeload.github.com/phien-ntace/how_to_use_git/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phien-ntace%2Fhow_to_use_git/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35661229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-19T02:00:06.923Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git"],"created_at":"2026-07-19T18:04:06.478Z","updated_at":"2026-07-19T18:04:07.080Z","avatar_url":"https://github.com/phien-ntace.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 1/ Initial information\n#### git config --global user.name \"xxx xxx\" \n#### git config --global user.email \"xxx@gmail.com\"\n \n# 2/ Check information\n#### git config --list\n \n# 3/ Create local repository\n#### git init code_folder_git\n \n# 4/ Copy current project to code_folder_git\n \n# 5/ Add code and commit\n#### git add .\n#### git commit -m \"First Commit\"\n \n# 6/ Create repository in github\n \n# 7/ Push to server\n#### git remote add origin https://github.com/phien-ntace/how_to_use_git.git\n#### git push -u origin main`* (origin: default name of repository on your PC)\n \n# 8/ Update code (safe team workflow)\n### Step 1: Always update your local code before pushing\n#### git pull --rebase origin main\n \n### Step 2: Add, commit and push normally\n#### git add .\n#### git commit -m \"Your changes\"\n#### git push origin main\n \n#### If conflict happens during pull (both modified same file/line):\n- Git will show CONFLICT and stop.\n- You must open the file and resolve the conflict manually.\n- After resolving:  \n#### git add \u003cconflicted_file\u003e\n#### git rebase --continue\n#### git push origin main\n \n# 9/ Delete a file\n#### git rm $file_name\n#### git push origin main\n \n# 10/ Get log and status\n#### git log\n#### git status \n \n# 11/ Branch\n#### Check current branch: git branch\n#### Switch to branch name: git checkout branch_name\n\n#### Create branch: git branch branch_name\n#### Push branch first time: git push --set-upstream branch_name  \n#### Merge branch to main: git checkout main + git merge branch_name\n\n# 12/ Resolve conflict to pull\n- Method 1: Commit changed file and pull\n#### git add file_name  \n#### git commit -m \"...\"  \n#### git pull origin main  \n\n- Method 2: Use stash to store changes\n- If you don't want to commit yet and just want to temporarily save the changes before pulling.\n- If stash pop causes a conflict, Git will ask you to resolve it like a regular merge.\n#### git stash  \n#### git pull origin main  \n#### git stash pop  \n\n- Method 3: Discard changes (do not keep edited file)\n- If you don't need the current .vscode/settings.json and want to overwrite it with the latest version from GitHub:\n#### git checkout -- file_name  \n#### git pull origin main  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphien-ntace%2Fhow_to_use_git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphien-ntace%2Fhow_to_use_git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphien-ntace%2Fhow_to_use_git/lists"}