0
点赞
收藏
分享

微信扫一扫

Git Cherry-Pick命令详解:轻松选取与移植提交

   🌈个人主页:秦jh__https://blog.csdn.net/qinjh_?spm=1010.2135.3001.5343
🔥 系列专栏:https://blog.csdn.net/qinjh_/category_12625432.html

9efbcbc3d25747719da38c01b3fa9b4f.gif

目录

前言

 Linux项目自动化构建工具-make/Makefile

举例

 .PHONY

常见符号

 依赖关系实例 

 Linux第一个小程序-进度条

缓冲区​编辑

 进度条版本1(直接显示)

 版本2(下载场景)

Main.c

 Processbar.c

 Processbar.h

使用 git 命令行

安装 git 

 使用 Gitee 创建项目

 拉取

​编辑​编辑

本地传到远程

 过程解释

修改内容


前言

 Linux项目自动化构建工具-make/Makefile

 make是一个命令工具,是一个解释makefile中指令的命令工具,make是一条命令,makefile是一个文件,两个搭配使用,完成项目自动化构建。

举例

 .PHONY

常见符号

 

 依赖关系实例 

 Linux第一个小程序-进度条

缓冲区

 

冲刷缓冲区有三种方法:

  1. \n
  2. 缓冲区满了
  3. 强制刷新:fflush 

 

 

 进度条版本1(直接显示)

 版本2(下载场景)

Main.c

#include "Processbar.h"

double bandwidth=1024*1024*1.0;

//donwload
void download(double filesize,callback_t cb)
{
  double current=0.0;

  printf("download begin,current:%lf\n",current);
  while(current<=filesize)
  {
    cb(filesize,current);
    current+=bandwidth;
    usleep(10000);
  }
  printf("\ndownload done,filesize:%lf\n",filesize);
}

int main()
{
  download(100*1024*1024,Procbar);
  download(20*1024*1024,Procbar);
  download(3*1024*1024,Procbar);
  download(125*1024*1024,Procbar);
  //Procbar(100.0,46.2);
  //Procbar(100.0,77.8);
 //Procbar(100.0,99.9);
 // Procbar();

//  ForTest();
  return 0;
}

 Processbar.c

#include "Processbar.h"
#include<string.h>
#include<unistd.h>

#define Length 101
#define Style '#'

const char* label="|/-\\";

//version1
//void Procbar()
//{
//  char bar[Length];
//  memset(bar,'\0',sizeof(bar));
//  int len=strlen(label);
//
//  int cnt=0;
//  while(cnt<=100)
//  {
//    printf("[%-100s][%3d%%][%c]\r",bar,cnt,label[cnt%len]);
//    fflush(stdout);
//    bar[cnt++]=Style;
//    usleep(20000);
//  }
//  printf("\n");
//}

//version 2
void Procbar(double total,double current)
{
  char bar[Length];
  memset(bar,'\0',sizeof(bar));
  int len=strlen(label);

  int cnt=0;
  double rate=(current*100.0)/total;
  int loop_count=(int)rate;
  while(cnt<=loop_count)
  {
    bar[cnt++]=Style;
   // usleep(20000);
  }
  printf("[%-100s][%.1lf%%][%c]\r",bar,rate,label[cnt%len]);
  fflush(stdout);
}



//void ForTest()
//{
//  printf("This is for test\n");
//  printf("This is for test\n");
//  printf("This is for test\n");
//  printf("This is for test\n");
//  printf("This is for test\n");
//  printf("This is for test\n");
//}

 Processbar.h

#pragma once 

#include <stdio.h>
typedef void(*callback_t)(double,double);

void Procbar(double total,double current);

//void Procbar();

//extern void ForTest();

运行结果图:

使用 git 命令行

安装 git 

 使用 Gitee 创建项目

git是一个工具,gitee、github就是为这个工具搭建的网站,即可视化。

 拉取

本地传到远程

 过程解释

修改内容

举报

相关推荐

git cherry-pick用法详解

git cherry-pick

git cherry-pick 用法

git cherry-pick -m使用

0 条评论